dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.92k stars 4.01k forks source link

Decompiler does not decode some assemblies... #58192

Open jogibear9988 opened 2 years ago

jogibear9988 commented 2 years ago

Version Used: VS2022

Steps to Reproduce:

  1. Try to Decompile Microsoft.Data.SqlClient, class TdsParser

Expected Behavior: should work

Actual Behavior: you got following error in static constructor: /OpCode not supported: LdMemberToken/

jogibear9988 commented 2 years ago

see also issue here: https://github.com/icsharpcode/ILSpy/issues/2571

jogibear9988 commented 2 years ago

and should be solved (maybe) with this pull req: https://github.com/dotnet/roslyn/pull/53304

dgrunwald commented 2 years ago

This is won't be fixed by updating the decompiler; the root cause is that VS doesn't initialize the type system with a correct set of reference assemblies. As a result the decompiler type system cannot find type System.Array, which prevents the array transforms from working, which in turn prevents the dynamic transform from working.

davidwengier commented 2 years ago

Also reported (sort of) as: https://developercommunity.visualstudio.com/t/%E6%9C%89%E7%9A%84%E6%96%87%E4%BB%B6%E5%8F%8D%E7%BC%96%E8%AF%91%E4%B9%8B%E5%90%8E%E9%87%8C%E9%9D%A2%E7%9A%84class%E6%97%A0%E6%B3%95%E6%8C%89F12%E8%B7%B3%E8%BD%AC%E8%BF%9B%E5%8E%BB%E3%80%82%E3%80%82%E3%80%82%E3%80%82/1623920