4

I have set up Visual Studio 2012 Professional to download debug symbols. It is set up correctly and the symbols have downloaded.

I get to the line of code I wish to step into:

bool result = Membership.ValidateUser("user", "password");

I right click on it and choose step into specific-->Membership.ValidateUser()

Then a tab opens in Visual Studio saying:

No Source Available - There is no source code available for the current location

Membership.ValidateUser() is in the System.Web.Security namespace which is in the System.Web.dll. If I open up the Modules window I can clearly see that the symbols for this assembly have been downloaded.

If the symbols are there, why am I not able to step into the source code?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Duncan Gravill
  • 4,552
  • 7
  • 34
  • 51
  • 1
    See [this](http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx). Scroll down to "FAQ/TROUBLESHOOTING" and look at step 3. – Lander Mar 23 '12 at 17:51
  • Thanks Lander, I have tried this step but it has not resolved the problem. – Duncan Gravill Mar 23 '12 at 18:16

4 Answers4

2

You may have the Symbols but you DON't have the source code. PDB's are not sufficient for debugging but they are necessarily to link your source code with the executable. PDB's are good to report bugs because they provide detailed information of call stack, in order to debug though, you need to have the source code.

Sofian Hnaide
  • 2,284
  • 16
  • 13
  • surely if I have .net framework 4.0 then I should have the source as System.Web.dll is part of .net - so why would VS not be able to see the source code, how do I fix this? – Duncan Gravill Mar 23 '12 at 18:15
  • 1
    the System.Web.dll is just the compiled code. You'd need to have the .cs ou .vb file from System.Web – Adauto Mar 23 '12 at 21:23
  • @Adauto sorry but you are wrong. This is what symbols are for. The dll is disassebled and the symbols make it possible to see the names of methods etc. – Duncan Gravill Mar 24 '12 at 00:12
  • From blogs.msdn.com/b/sburke/archive/2008/01/16/… faq (3 it looks like he is right in a way and while a PDB has call stack information etc. it might still miss the source code, and when downloading from referenceserver.microsoft.com/symbols you actually get a .cs file in the temp folder – yoel halb Jul 16 '12 at 16:18
2

Source stepping is only available for RTM or SP releases. See PDB files for .NET Framework 3.5 SP1 not available! (i.e. System.Web.pdb 2.0.50727.4016).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Richard Anthony Hein
  • 10,550
  • 3
  • 42
  • 62
  • Hi Richard, I tried opening up the source class definition by putting the cursor on the method call and pressing F12 I it wouldn't let me set any breakpoints. What did you mean by breaking into the source code? How do I do that? I have just been right clicking on the method and choosing 'step into specific'. Also all the frames in the call stack have already had their symbols loaded. None are greyed out and if I right click the 'load symbols' is greyed out in the menu. The other settings you mentioned I already have correct. – Duncan Gravill Mar 23 '12 at 18:58
  • I don't think this is the problem because .net 4.0 was released a long time ago. In fact they are getting ready to release 4.5 And I have already determined that I am successfully downloading the System.Web.pdb file that matches my version of .net, for some reason though it isn't stepping into the source code. – Duncan Gravill Mar 23 '12 at 19:05
  • @FunkyFresh84 I think you'll just need to check if System.Web.dll was patched/hotfixed at all. – Richard Anthony Hein Mar 23 '12 at 19:06
  • Richard, I am trying the approach of downloading the source code and symbols as described in Cory Plotts post in the link you have given. I have downloaded .net 4.0 source and installed it to my C:\Users\Duncan\Documents\RefSrc folder. How do I now configure VS to use the source and symbols at this location? thanks – Duncan Gravill Mar 23 '12 at 20:03
  • @FunkyFresh84 I don't think it will work for you because 4.5 has a new version of System.Web.dll that is used by 4.0. If you wanted to debug 4.0, you need to install 4.0 on a clean box or VM (say, with VS2010). Look at the changes in 4.5 to ASP.NET (which includes System.Web.dll, of course): http://www.asp.net/vnext/overview/whitepapers/whats-new#_Toc318097382. If you delete your Symbol cache (or move location), it will attempt to pull down the version. The version pulled down with 4.0 selected, is the same version of System.Web.dll that targeting 4.5 uses. – Richard Anthony Hein Mar 23 '12 at 20:42
  • @FunkyFresh84 See also: http://blogs.msdn.com/b/dotnet/archive/2011/09/26/compatibility-of-net-framework-4-5.aspx. This shows that the 4.5 version of System.Web.dll indeed replaces the 4.0 version. They are no longer compatible. This is yet another reason why this was a bad idea (keeping the same version #'s in 4.5 vs. 4.0). – Richard Anthony Hein Mar 23 '12 at 20:46
1

I ran into the same problem and in my case it is version 4.0 and not 4.5, but still the same problem.

After checking with fiddler it appears that for many DLL files the server at referenceserver.microsoft.com returns 404 and Visual Studio then falls back and downloads it from the Microsoft symbol server at msdl.microsoft.com which doesn't contains the actual source code.

So at the end of the day, source stepping with Microsoft's code doesn't appear to always work, and one might resort to using .NET Reflector.

I have just found another Stack Overflow answer, .NET framework source stepping not working despite options set, and according to it the problem might be related to SP1.

Community
  • 1
  • 1
yoel halb
  • 12,188
  • 3
  • 57
  • 52
1

I had the similar problem, and this is how I solved it.

Right click your project -> Properties - > Compile -> Advanced Compile Options...

Then Set 'Generate debug info' to 'Full' from the drop down menu.

Hope that helps.

curiousBoy
  • 6,334
  • 5
  • 48
  • 56