To enable Source Link in Visual Studio for Mac, go to Visual Studio > Preferences… > Projects > Debugger and ensure that the Step into external code option is checked. Click OK to save your changes.
To debug . NET and ASP.NET Core source code in Visual Studio: In Tools -> Options -> Debugging -> General, un-check Enable Just My Code. Verify Enable Source Link support is checked.
The PDBs for stepping through the source code are only posted for RTM and Service Packs. As such, when security update comes out and it modifies the dll you are trying to debug, it will cause source stepping to not work (that is, you'll get the "No source Available" with a greyed out "Browse to find Source").
However, once you've made all the appropriate settings, you can use the following workaround. The workaround is essentially to find the security updates that caused the dll to change, and then remove them. This has the obvious downside of having those security updates removed on your machine.
site:support.microsoft.com/kb System.Windows.Forms.dll 4.0.30319.269
http://support.microsoft.com/kb/2604121
, so KB2604121, is what we're interested in.You'll need to do this for each dll within the .NET framework that you care about debugging into.
Once that's done, set a breakpoint within the .net source (for example, go to the Breakpoints tab, say New->Break at Function, and enter System.Windows.Forms.Form.Form) or step into one of the .net methods in that dll.
While unfortunately there is a problem with a Microsoft, as Leppie pointed out (and I got the same result see
it should be noted that your attempt would fail anyway, since you referenced:
instead of:
referencesource.microsoft.com/symbols
See the FAQ/Troubleshooting section of Configuring Visual Studio to Debug .NET Framework Source Code
I have found the answer, I think.
I traced what was happening on Fiddler. It seems only the symbols are currently available, and no source.
When VS tries to load the symbols from the 'referencesource' server it fails (404). As this fails, I think it cannot map to source files on that server.
http://referencesource.microsoft.com/symbols/mscorlib.pdb/ED96A7F38A2940F39B9CA7AD9BC5CB671/mscorlib.pdb
After the above failure, it tries some server called 'msdl' where it finds the actual PDB (but it appears this one have no source code info).
http://msdl.microsoft.com/download/symbols/mscorlib.pdb/ED96A7F38A2940F39B9CA7AD9BC5CB671/mscorlib.pd_
All in all, it appears to be a (temporary) Microsoft issue with their servers.
I am sure I had some source code a while back. But now it is not working.
Edit:
I tried it with various .NET versions, all the same result. :(
For now it is not working if you have SP1 installed. Here are some comment about problem form MS: http://social.msdn.microsoft.com/Forums/en-US/refsourceserver/thread/41388c7b-582b-4e3f-8178-3d38a3c99639
In my case, I was debugging an old .NET 2.0 WinForms application and I got the "Source Not Available" message. I tried all the recommended settings.
Ultimately, I rebuilt the app to temporarily target .NET 4.5 and was able to get the source stepping to work. Perhaps my app was just too old for source stepping. Kind of defeats the purpose, I know, but for quick and dirty testing it works. The bug I have is still present in .NET 4.5. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With