Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed any attempt to handle ref assemblies via GAC when decompiling #1767

Merged
merged 2 commits into from
Apr 14, 2020

Conversation

filipw
Copy link
Member

@filipw filipw commented Apr 14, 2020

See the discussion here icsharpcode/ilspy-vscode#45 (comment)

Long story short, searching for ref assemblies in GAC results in no-definition found - Not Supported exception on Mono. This means that we can't decompile into BCL types on Mono. On Windows it "works" - as in, it doesn't crash, but it doesn't find implementation assemblies anyway.

This PR removes any attempt to handle ref assemblies; this means things should always decompile fine, but we won't find implementation assemblies. This is consistent with VS experience where ref assemblies are decompiled instead of implementation assemblies.

It's a super complex topic, and we can improve on that gradually in the future (or maybe VS implementation will improve).

@SirIntruder
Copy link
Contributor

Thanks for this! Decompilation of all System types were failing in Unity projects (that target .NetStandard API profile, which is default), I built the branch locally and it got System.String and friends decompiling again.

btw you mentioned it didn't crash, but I did find these exceptions on Windows previously (with logging set to debug).

"Request_seq": 261, "Command": "/gotoDefinition", "Running": true, "Success": false, "Message": "\"System.NotSupportedException: Decompiling types that are not part of the main module is not supported.\\r\\n at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileType(FullTypeName fullTypeName)\\r\\n at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileTypeAsString(FullTypeName fullTypeName)\\r\\n at OmniSharp.Roslyn.CSharp.Services.Decompilation.OmniSharpCSharpDecompiledSourceService.PerformDecompilation(Document document, String fullName, Compilation compilation, String assemblyLocation)

@filipw
Copy link
Member Author

filipw commented Apr 14, 2020

yeah it's the same exception. It would happen when the GAC entry for the implementation assembly was indeed found but at different version, which technically can happen on Windows too (although I have not seen it). the problem for finding the runtime assembly, especially from a different runtime is really complex and for now we should keep it simple.
also the original code was internalized from Roslyn (the code editor assembly which is Windows only) and it was never intended to be used on Mono so that only makes the problem worse

with this change it should just continue to the ref assembly, which is of limited value but it is a step in the right direction

@filipw filipw merged commit 1318036 into master Apr 14, 2020
@filipw filipw deleted the bugfix/decompile-gac branch April 14, 2020 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants