2

This is embarrassing -- I've been programming .NET for many years and despite following the MSDN instructions for debugging the .NET sources, I've never been able to get it to work.

When I attempt to step into some Framework code (the c'tor for StringBuilder, for example), the debugger just skips right over, onto the next statement. I can't step into any framework code.

I'm using VS 2017, Framework v4.7.

Below are the debugging options.

enter image description here enter image description here



Community
  • 1
  • 1
Tom Baxter
  • 2,110
  • 2
  • 19
  • 38
  • Microsoft fails to always provide latest symbol files for all .NET Framework releases, so what you experienced is normal. Anyway the source code is just for reference purposes, and if you do meet critical product issues, you should open a support case via http://support.microsoft.com – Lex Li Aug 23 '17 at 00:05
  • @Lex - I think what you said cannot be correct. I just dropped down to Framework v4 and I have the same problem. What do you mean the source code is just for "reference purposes"? No it's not -- it's for debugging and stepping into. – Tom Baxter Aug 23 '17 at 03:35
  • Possible duplicate of [Cannot step into .NET framework source code](https://stackoverflow.com/questions/27655014/cannot-step-into-net-framework-source-code) – Hans Passant Aug 28 '17 at 10:14

1 Answers1

0

Go to Symbols and add this URL http://referencesource.microsoft.com/symbols and a local cache path.

Please see:

https://blogs.msdn.microsoft.com/sburke/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code/

Other community members asked the simliar issue about debugging the .NET 4.6 here:

How do I debug .NET 4.6 framework source code in Visual Studio 2017?

Update:

It really has this issue from old VS version to VS2017, anyway, since we could repro this issue now, if possible, like Leo's suggestion, you could vote and add your comment here:

https://developercommunity.visualstudio.com/content/problem/101533/could-not-debug-net-framework-on-windws-10-machine.html

Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • The "search only when symbols are loaded manually" option does not seem to be available or has been moved somewhere as it is not showing up on the window. – Jason H Aug 23 '17 at 07:59
  • @JasonH, it was an option in old VS version, thanks for your feedback. – Jack Zhai Aug 23 '17 at 08:12
  • is there not something similar in VS2017? – Jason H Aug 23 '17 at 08:31
  • @JackZhai-MSFT, Microsoft seems to have abandoned this feature. No wonder Apple is eating your lunch. The link you sent me was from 2008, and it didn't work.The link I originally posted is from 2016, which didn't work. The instructions at "http://referencesource.microsoft.com" have a link for configuring VS 2013 (an old version) and those instructions don't work either. See a pattern? This feature has been around a long time now. I got it to work once a few years ago but never again. This stuff should be seamless by now. It should be easy. – Tom Baxter Aug 23 '17 at 15:12
  • @TomBaxter, According to the second link that Jack provided, I configure my VS2017 with below steps and it works. And based on your screenshot, please also checked all sub-options of “Enable source server support” and checked “Require source files to exactly match the original version” option in VS Options -> Debugging -> General. – Leo Liu Aug 24 '17 at 05:42
  • @Leo-MSFT I updated the my config as you described but I get the exact same result -- skipping over framework code. Are you using Framework 4.7? I have the Modules window open when I debug and the .pdb files are loaded successfully (for System.dll and mscorlib.dll). In the Modules window, under the "Version" column it reads this: "4.7.2531.0 built by: NET471REL1". In the Output window it reads this: "Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Symbols loaded." – Tom Baxter Aug 24 '17 at 14:28
  • @TomBaxter, I have tested this issue with my colleague. We found this problem occurs on Windows 10 machine. It could debug on Windows 7 machine with above Visual Studio settings. We have submit this issue to Visual Studio Developer Community. You could vote it from this link: https://developercommunity.visualstudio.com/content/problem/101533/could-not-debug-net-framework-on-windws-10-machine.html – Leo Liu Aug 25 '17 at 08:55
  • @Leo-MSFT - THANK YOU! – Tom Baxter Aug 25 '17 at 14:48
  • @TomBaxter, I just edit my previous answer, since leo help you report this issue to the product team, you could vote and add your comment there. The product team would share the update if they get any useful information. – Jack Zhai Aug 28 '17 at 09:25