CLR Stack Explorer – Preview

July 19, 2011


Synopsis: CLR Stack Explorer obtains reliable call stacks of managed processes, supports any combination of 32-bit/64-bit and CLR2/CLR4.

UPDATE [2011/7/20]: If you downloaded CLR Stack Explorer from the above link and are using a recent Windows version, you need to Unblock all the .exe files (right-click, Properties, Unblock) for the tool to run correctly. I have just updated the download location with a self-extracting executable which should solve this problem.

I’m happy to announce that CLR Stack Explorer, a tool I’ve been working on during the last few days, is now ready for preview. Frankly, I have Managed Stack Explorer to thank for this little project – its lack of support for CLR 4 has encouraged me to embark on this journey.

You can find the bits here – but please remember this is a very early preview with probably lots of bugs. Your process may crash as a result of using this tool to view its call stacks.

This is the basic experience when using CLR Stack Explorer:


The tool consists of several components:

  • C++/CLI assembly which contains the necessary interactions with the unmanaged CLR Debugging APIs. This assembly exports an unmanaged class, too – so it can be used without the rest of the code.
  • C# WinForms GUI that displays a list of relevant managed processes and obtains call stacks from…
  • …a C# WCF service that listens over a named pipe for requests to obtain process call stacks. The reason for this service is that the CLR Debugging APIs don’t support cross-bitness debugging, i.e. a 32-bit debugger process can’t obtain call stacks of 64-bit processes and vice versa. Instead of having two separate GUI versions for 32-bit and 64-bit, the GUI talks to two separate services (32-bit and 64-bit) which provide the information.

As I was going at it I found that it would be pretty easy to add source browsing support, so if you have sources at the right location you can double-click a stack frame and go to the line of code:


Also, CLR 4 features a nice addition to the Debugging API which lets a debugger easily see which thread is holding a Monitor (lock) and which threads are waiting for a Monitor using Monitor.Wait. This information is made available through the GUI when right-clicking a thread:


If you find this tool useful, please let me know. It’s been a pleasure writing it so far, and I’m planning to go on – some of the things I have on my TODO list:

  • Use GetActiveInternalFrames to retrieve internal frames and display them on the stack (e.g. managed-unmanaged transition)
  • Consider moving to ICorDebugStackWalk
  • Consider support for unmanaged frames
  • Perform automatic deadlock detection
  • Cache module metadata and symbol information
  • Symbol path support (currently it’s just the current directory)
  • Source path support (e.g. prompt the user for source location)
Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. Huseyin TufekcilerliJuly 19, 2011 ב 10:25 PM

    Wow, this will definitely help me on a future debugging session. Keep up the great work!

  2. GiorgiJuly 20, 2011 ב 1:05 PM

    You can also use mdbg 4.0 to get managed stacks. The Managed Stack Explorer is based on an earlier version of mdbg.

  3. Joakim DahlJuly 20, 2011 ב 4:01 PM

    Great work! Now if they only could add this to ‘process explorer’ also

  4. JaspioJuly 20, 2011 ב 5:15 PM

    Any tips on how to get this working on Win7 x64?
    I keep on getting the error “cannot find file” when retrieving the process list

  5. NickJuly 21, 2011 ב 12:26 PM

    is there x64 Version of the preview? I assume the error message “Error retrieving processes: Unknown error (0xffffffe)” has to that i use the x86 version on Windows 7 SP1 x64.

  6. Sasha GoldshteinJuly 22, 2011 ב 3:19 PM

    @Jaspio, @Nick:

    Thanks for checking out the app. The 32-bit GUI works with 32-bit and 64-bit processes (by using two additional sub-processes). I tested the release on my Windows 7 SP1 x64 system.

    Have you downloaded the self-extracting EXE version, in which unblocking is no longer required? If you still have problems, please shoot me an email (through the contact form).

    Thanks a lot.

  7. radiyJuly 23, 2011 ב 2:49 PM

    source code?

  8. Sasha GoldshteinJuly 23, 2011 ב 6:55 PM

    @radiy: will be published on CodePlex or similar as soon as I clean it up and fix some initial bugs.

  9. AndyJuly 28, 2011 ב 10:07 PM

    It crashes when I try to run it on a Windows Server 2008 🙁

  10. madhuOctober 21, 2011 ב 2:06 PM

    We really need this tool. Appreciate your effort. Any reason why you are not using MdbgCore ( managed clr debugger library )

  11. Omer RavivNovember 17, 2011 ב 10:09 AM

    This tool is wonderful! *Extremely* useful in many real world scenarios, especially when there’s a client on the other side of the world experiencing a hang!

    My top feature requests would be:
    1. Show thread names / highlight the “Main” UI thread.
    2. The ability to export the entire output to a text file.

  12. Steve BinneyDecember 1, 2011 ב 4:22 AM

    Is the source code available?

  13. AndrewJanuary 20, 2012 ב 4:03 PM

    The tool is useful to me too.
    Having source code would be great.
    Several bugs: do not display services even if Explorer running as admin
    If it can’t attach to process (already debugged) it shows error message, but after several tries, crashes.

    Also all “Service” application crashes when I start them. I don’t know if I need to start them at all.
    I have Win 7 x64

  14. jimJune 22, 2012 ב 10:44 PM

    the tool is very userful for me ,Please keep up the great work!
    and the tools request msvcr100.dll.

    1. aaApril 13, 2014 ב 3:22 PM

      Thanks! Copying msvcr100.dll eliminates FileNotFoundException

  15. aaasoftJune 21, 2014 ב 4:49 AM

    Thanks,this tool is very useful for me.Great job!

  16. adsenseFebruary 17, 2015 ב 4:57 PM

    You really make it appear so easy along with your presentation however I to find this topic to be actually
    something which I think I might never understand.
    It kind of feels too complicated and very large for me.

    I am having a look forward for your subsequent submit, I’ll try to get
    the hold of it!

  17. HarveyOctober 25, 2015 ב 3:14 AM

    Please update/improve the tool. Its really useful!