vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

F12 stopped working on linux

Open koyllis opened this issue 3 years ago • 10 comments

After version 1.80 F12 just stopped working on ubuntu!

koyllis avatar Aug 09 '23 11:08 koyllis

Can you share what kind of project you're trying to load and the output from the 'C#' output window?

dibarbet avatar Aug 10 '23 01:08 dibarbet

Its a library project. The output says this -> otnet path: /home/koyllis/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet Activating C# standalone... info: LanguageServerHost[0] Starting server...

But anyways all procjects behave the same.. For example if you press F12 on DateTime it says definition not found! On windows its ok!

koyllis avatar Aug 10 '23 04:08 koyllis

I'm on windows and I actually get the same error. When I press F12 on anything I get an error message like:

The editor could not be opened due to an unexpected error: Unable to resolve resource
c:%5CUsers%5Cuser%5CDesktop%5CMyProject%5CSomeCodeFile.cs

I don't know if that helps but in die "Window" output I get the following stacktrace:

2023-08-10 09:49:25.439 [error] Error: Unable to resolve resource c:%5CUsers%5Cuser%5CDesktopMyProject%5CSomeCodeFile.cs
    at r.m (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2308:37515)
    at r.m (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2308:37501)
    at async d.acquire (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:19:30395)
    at async c.createModelReference (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2308:38836)
    at async fo.resolve (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1848:39377)
    at async uh.setInput (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2297:11340)
    at async s.M (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2295:20269)
    at async s.D (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2295:18937)
    at async s.openEditor (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2295:17925)
    at async vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2480:12423
    at async v.G (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1158:85944)
    at async v.openCodeEditor (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:702:4545)
    at async Ar.m (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:758:56760)
    at async Ar.l (vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:758:56548)

stesto avatar Aug 10 '23 07:08 stesto

Check whether your C# extension is pre-release version. If it's, switch back to the stable one. That helps resolve the problem in my case

lyhongnhat avatar Aug 10 '23 09:08 lyhongnhat

Check whether your C# extension is pre-release version. If it's, switch back to the stable one. That helps resolve the problem in my case

I already rolled back to a previous version, it solved it in my case too. Thanks,

stesto avatar Aug 10 '23 09:08 stesto

I noticed that when a .sln file is present then everything works fine! But if you open a .csproj it just stops working!

In other works if the folder does not contain a .sln file then F12 Fails!

koyllis avatar Aug 10 '23 10:08 koyllis

Had the same issue on Linux.

I installed an older version of the C# Dev Kit (0.2.100) extension, it started to work. Then I re-updated to the latest one (0.3.21), and it is still working.

cafenroy avatar Aug 10 '23 12:08 cafenroy

I also get the same "The editor could not be opened due to an unexpected error: Unable to resolve resource" on Windows. Rolled back ms-dotnettools.csharp to 2.0.328 and it works again.

lars-nystrom-mio avatar Aug 10 '23 12:08 lars-nystrom-mio

The only solution that works for now is to create a sln file and include the csproj ...

koyllis avatar Aug 10 '23 12:08 koyllis

I noticed that when a .sln file is present then everything works fine! But if you open a .csproj it just stops working!

Yup this is a known issue that has been fixed (hopefully will be released later today). See https://github.com/dotnet/vscode-csharp/issues/6013

When I press F12 on anything I get an error message like: The editor could not be opened due to an unexpected error: Unable to resolve resource c:%5CUsers%5Cuser%5CDesktop%5CMyProject%5CSomeCodeFile.cs

This is also known, and should be fixed in the same release. Fix was merged in https://github.com/dotnet/vscode-csharp/pull/6091

I'll close this issue since I think all the problems listed are known and should be resolved in the upcoming release.

dibarbet avatar Aug 10 '23 19:08 dibarbet