C#, Tech

Application logs painkiller – Stack Trace Explorer

Reading application’s logs is not a big fun but let’s be honest – it is part of our job and we will not avoid it. So why don’t we make it slightly more pleasant?
Stack traces explorers to the rescue!

In fact, I didn’t know about the existence of stack trace explorers till the day I copied a part of app’s log to my clipboard with the plan to send it to the colleague. But when I opened Visual Studio a magic happened, fairytales flew on my desk and opened a new tab in my IDE.

Photo by Ken Treloar on Unsplash

And before the sparkling moon dust fell to the carpet I was sitting staring at the stack trace appearing in the Visual Studio’s tab, thinking ‘what the heck?! Did I copy-pasted it here earlier or what?’.

Yeah, enough bullsh*t, you now know what stack trace explorer is 😉.


Stack Trace Explorer (Resharper tool)

In my story, the fairytale turned out to be Resharper’s tool. I really liked the idea of opening a new tab in Visual Studio automatically, immediately when Resharper discovered stack trace in my clipboard. On the other hand, it always annoys me that I forget how easily everybody can have access to my clipboard, really! 😉
If the Stack Trace tab don’t appear, we can always make it to do so by pressing Ctrl + E, T. It can be handy one day, when you decide that Resharper’s default behavior makes you uncomfortable, and you uncheck ‘Auto open external Stack Traces’ on the Tools -> Stack Trace Explorer page of ReSharper options.
Using this tool is extremely easy – the lines of code in Stack Trace explorer are clickable, so by clicking on them you navigate through your code.

Stack Trace Explorer (free version)

If you don’t have Resharper, you can still have a little helper by your side. Just install Visual Studio’s extension – Stack Trace Explorer (download it from Microsoft Store or install from Visual Studio -> Tools -> Extensions and Updates).

Installation of this extension can be scheduled (it was in my case), so you need to restart Visual Studio and then install the extension by clicking button ‘Modify’ in the small window that opens. The name of a button (yep, ‘Modify’) is also a mystery to me but it installs the extension anyway, so let’s just let it go.
Back to the topic – the extension does similar job to Resharper’s tool with the exception of reading the stack trace from your clipboard. This time you have to open a tab on your own (by selecting View -> Other windows -> Stack Trace Explorer or pressing Ctrl + S,T) and paste the stack trace manually to the tab. All the rest functionalities seem to work the same.

Below I compared the above two tools:

Stack Trace from Resharper Stack Trace Explorer (free)
  • Requires (paid) Resharper installed (available in demo version too 😉 )
  • Was probably the first to introduce the idea 😉
  • Automatically opens itself when recognize a stack trace in your clipboard
  • Bigger font size in the extension tab (message to my husband – yes, yes, yes, I remember I have to change my glasses to stronger!)
  • Free
  • Open source project
  • It is possible to open many tabs with different stack traces in each
  • Requires opening a tab and pasting stack trace there
  • You can load a whole log file (directly from the file)
  • Changes color of clicked lines (in VS dark mode: from blue to purple)

After a few days of testing both Visual Studio extensions (Resharper’s at work and the free one at home), I didn’t encounter any troubles. What is more, I found these little helpers very useful, especially when I had to check the logs of code that changed since the error was logged (so line numbers in log file don’t match but classes and methods names does). That’s why I encourage you to check it on your own. Or maybe you already have heard about it and use it regularly? Let me know in the comment!

Featured photo by rawpixel on Unsplash

Share this: