mercredi 18 juillet 2018

Decompiling .NET assemblies only shows throw null;

I want to know more about how the things in System.Linq.Expression.* work.

First approach:

VisualStudio tells me this is the file I'm looking for: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll

So I opened that file in dnSpy, but it has no implementation whatsoever for the types I want to see. Literally everything is implemented as throw null;

How I got that path:

So what I did was simply referencing one of the types System.Linq.Expressions.Expression in visual studio, highlighting it and pressing F12.

VisualStudio shows a nice metadata file, at top of which it shows this:

#region Assembly System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll
#endregion

Am I opening the wrong file, and the real definitions are actually somewhere else?

Alternative

I know that there's also the official microsoft reference source code on the internet, where, to my surprise everything is shown very plainly just as expected!

Question

Since this is (to me at least) a very confusing problem I don't really know what the right question to ask even is. I guess, as it is often the case, someone who knows more about these things can most likely explain away everything with a single answer (probably even without actually answering all those questions below individually, but I would appreciate it how :) )

  • Why does decompiling every other type I tried work fine?
  • What is so special about System.Linq.Expressions.* ?
  • From the reference source I can see that the file itself lives in Microsoft/Scripting/Ast/, so I thought that maybe a .dll named similar to that exists somewhere, but I was not able to find it (which is expected, right? folder structure of source files says literally nothing about the namespaces, it just so happens that by convention most programmers try to make folder structure of source files match the namespaces when possible)
  • Does this have something to do with DebuggerTypeProxy
  • Am I opening the wrong file? If so, which one is the right one? And even more importantly, how would I find that one myself?




Aucun commentaire:

Enregistrer un commentaire