I think that you must have heard about .NET Source Stepping feature in Visual Studio which allow a developer to debug .NET. It is a cool thing but my experience shows that it sometimes works and sometimes not. I think that it happens because Visual Studio can have problems to download appropriate version of symbols from Microsoft Symbol Server. However, recenly I've figured out that it can be done in a different way i.e. we can use the free .NET decompiler dotPeek from JetBrains. To be honest I've been using dotPeek since .NET Reflector is not free and it works great but for a long time I wasn't aware that dotPeek can play a role of a symbol server. When I told about this to my friends they were also surprised (in a positive way) so here is a short How-to.
- Run dotPeek.
- Select Tools -> Start Symbol Server
- By default a server will be available under http://localhost:33417
- Start and configure Visual Studio.
- Now Visual Studio will be trying to download symbols and source code from dotPeek.
- dotPeek will be generating them (symbols and source code) in flight by decompiling assemblies .
- Visual Studio caches symbols on the disk so dotPeek doesn't have to be running all the time.
- It is worth mentioning that you can set a breakpoint in decompiled source code!
- If for some reasons Visual Studio will not download symbols from dotPeek you can enforce this from Modules or Call Stack windows in Visual Studio. To do so select Load Symbols command from the context menu.
- You have to remember about one drawback. If you enable external symbol server in Visual Studio it may cause that starting a debugging session will take considerable longer time because IDE will try to download symbols for all assemblies.