1

I'm trying to track down a WCF issue, and something that would help would be to break into the framework source. I already found the section in the .net reference source that I want to step into, but the challenge is that I can't see to get the debugger to step into the code for System.ServiceModel. I've followed the steps outlined here for setting up VS (although in my case I'm on 2019 enterprise). I tried this:

var d=new Dictionary<int, int>().TryGetValue(3, out int x);

And was able to step into TryGetValue in mscorlib.dll, but this:

NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.TransportWithMessageCredential);
BindingElementCollection outputBec = tcpBinding.CreateBindingElements();

Won't let me step into either the NetTcpBinding constructor or the CreateBindingElements method, which I know exists in the reference source.

The modules window shows that System.ServiceModel.dll is loaded from:

"C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll", 

and that the symbols are loaded from:

D:\SymbolCache\System.ServiceModel.pdb\0811c462ccbb4a418946598a612f96cd2\System.ServiceModel.pdb    6   4.8.3825.0 built by: NET48REL1LAST_B    5/31/2019 9:51 PM   

I did notice that for mscorlib.dll the version was coming back as "4.8.3815.0 built by: NET48REL1LAST_C", but I'm not seeing any prerelease .net 4.8 versions installed. I've also tried disabling all symbol sources except for http://referencesource.microsoft.com/symbols, and clearing the symbol cache.

So at this point I have two questions:

1-Is there something else I should try to get .net reference source stepping to work in this case? I suspect a version mismatch, but the reference source pages don't specify the exact versions of assemblies that they're for.

2-Is there a way to verify the assembly version number from a C# PDB file? I have the PDB that I cached from the reference source, but I can't tell which assembly version this maps to.

Chris Bardon
  • 430
  • 4
  • 13
  • 1
    https://stackoverflow.com/questions/27655014/cannot-step-into-net-framework-source-code – Hans Passant Sep 10 '19 at 14:12
  • Right, I saw that post from a few years back, and that's why I tried updating the project to 4.8 from 4.7.2, which is what the reference source home page refers to. The patch version on the assembly is also at a .0, which implies that it's the RTM version, so it should match what's in the reference source. You're right though-checking the Symbol load information shows that the symbol information isn't found on the reference source servers. – Chris Bardon Sep 10 '19 at 14:26
  • Maybe you can try using local source files like [this issue](https://stackoverflow.com/a/57174591/10910450). Note: The breakpoints may hit random lines. – LoLance Sep 12 '19 at 06:16
  • 1
    I ended up getting around this by just using DotPeek and its local symbol server, and decompiling the exact versions the application loaded. I was hoping to be able to use the reference source to get exact matches, but never managed to get it to load for everything. – Chris Bardon Sep 13 '19 at 17:32
  • It seems to be a workaround, maybe you can consider making this workaround an answer :) – LoLance Sep 16 '19 at 09:29
  • I thought about that, but it's not really an answer to the question. I wanted to know whether it was possible to use just the reference source, and why the instructions on the reference source page don't work. DotPeek is a reasonable workaround, but it's based on decompiled source, so it doesn't match 1:1. – Chris Bardon Sep 17 '19 at 14:05

0 Answers0