dotnet/vscode-csharp

The omnisharp.enableDecompilationSupport setting doesn't enable decompilation

cateyes99 opened this issue · 9 comments

VSCode version: 1.60.2
C# Extension: 1.23.16

Steps to reproduce

Set the omnisharp.enableDecompilationSupport to true in VSCode's settings.json.

Expected behavior

F12 (Go to Definition) should navigate to the decompiled the source code.

Actual behavior

It doesn't, but just navigates to metadata. So omnisharp.enableDecompilationSupport looks like having no effect.

Look like, leave this setting with its default value, i.e., omnisharp.enableDecompilationSupport = false, but adding the below settings into the file %USERPROFILE%/.omnisharp/omnisharp.json

    "RoslynExtensionsOptions": {
        "enableDecompilationSupport": true
    }

will just enable the decompilation feature.

I am unfortunately unable to reproduce this problem.

Please set "omnisharp.loggingLevel":"debug" in VS Code and capture the debugging output in both cases. This should show the state of the decompilation flag in OmniSharp at runtime.
Setting "omnisharp.enableDecompilationSupport": true would also trigger a disclaimer warning which you need to accept, perhaps you didn't?

Also please note that omnisharp.json has higher precedence than the VS Code setting, so if you have "enableDecompilationSupport": false in omnisharp.json and "omnisharp.enableDecompilationSupport": true in VS Code settings, decompilation would not be enabled.

Setting "omnisharp.enableDecompilationSupport": true would also trigger a disclaimer warning which you need to accept, perhaps you didn't?

You can re-trigger the pop up by launching the CSharp: Show the decompiler terms agreement command

Oh I think I know what you mean now. This works fine when decompilation agreement is accepted in the current workspace. But the decompilation agreement is not shown anymore on subsequent starts of the VS Code and the decompilation consent is not persisted across starts, making the whole thing behave as if decompilation was off.

@JoeRobich @nohwnd looks like this change (?) broke this #4760? would you mind checking whether the consent is persisted correctly across VS Code starts

@cateyes99 Thanks for reporting. Once the fix merges I'll make a prerelease build that you can install. Will likely wait until next week for a new release to see if any other issues are reported.

@JoeRobich thanks. Just tried. Both 1.23.16 and 1.23.17-beta1 don't automatically trigger a disclaimer warning when setting "omnisharp.enableDecompilationSupport": true. But now manually triggering it by launching the CSharp: Show the decompiler terms agreement command will do, after accepting it decompilation works fine with both versions.

To make it trigger the disclaimer warning automatically with both versions, I found that the following odd steps:

  1. Set "omnisharp.enableDecompilationSupport": false
  2. Launching the CSharp: Show the decompiler terms agreement cammand. It actually doesn't show the popup of the decompiler terms agreement.
  3. Set "omnisharp.enableDecompilationSupport": true. There is a popup shown in the bottom right corner, asking restart OmniSharp. Don't restart OmniSharp, by just cancelling the popup.
  4. Now reload the window or just restart VSCode. At this point, I can see the decompiler terms agreement pops up automatically

Now the interesting difference between the 2 versions I observed is:
in the step 4, when the decompiler terms agreement popup shows, if i click Yes to accept it, for version 1.23.17-beta1, decompilation fine, while 1.23.16's still doesn't. To make 1.23.16 work, have to manually launch the CSharp: Show the decompiler terms agreement command, and then accept it. Well, since 1.23.17-beta1 works fine in this case, it should be ok i guess, even 1.23.16 doesn't.

But don't know why setting "omnisharp.enableDecompilationSupport": true won't trigger a disclaimer warning for me. Should i create another issue for it?

But don't know why setting "omnisharp.enableDecompilationSupport": true won't trigger a disclaimer warning for me. Should i create another issue for it?

I think we could clear the Decompilation Authorization when omnisharp.enableDecompilationSupport is set to false. It would then prompt the next time it was set back to true.

@JoeRobich this way sounds good 👍

@cateyes99 @JoeRobich
After reading this I cannot find the command for "CSharp: Show the decompiler terms agreement". Would I enter this in the command palette in vscode:

image

As you can see in the image I can't see any command that matches that.