dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 667 forks source link

Error while trying to accept autocomplete override suggestion #6866

Closed GGG-KILLER closed 7 months ago

GGG-KILLER commented 7 months ago

Type: Bug

Issue Description

While trying to accept an autocomplete override suggestion, the code is not inserted.

Steps to Reproduce

  1. Have a file where a class inherits from an abstract class with virtual methods.
  2. Type in override in the class body.
  3. Attempt to accept the suggested method to override.

Expected Behavior

Override is generated without any issues.

Actual Behavior

Nothing is added to the file.

Logs

Extension Host

2024-02-07 13:54:19.525 [error] CodeExpectedError: cannot open file:///file%3A/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs. Detail: Unable to read file '/file:/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs' (Error: Unable to resolve nonexistent file '/file:/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs')
    at r.$tryOpenDocument (vscode-file://vscode-app/nix/store/nlf8ql0bss1cf5cyv39849zmnzmkjqvz-vscode-1.86.0/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:2197:62910) roslyn.client.completionComplexEdit {"value":"ms-dotnettools.csharp","_lower":"ms-dotnettools.csharp"}
2024-02-07 13:54:19.525 [error] CodeExpectedError: cannot open file:///file%3A/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs. Detail: Unable to read file '/file:/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs' (Error: Unable to resolve nonexistent file '/file:/home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs')
    at r.$tryOpenDocument (vscode-file://vscode-app/nix/store/nlf8ql0bss1cf5cyv39849zmnzmkjqvz-vscode-1.86.0/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:2197:62910) roslyn.client.completionComplexEdit undefined

C# log

``` Installing Razor Telemetry Version = 7.0.0-preview.23627.2... Platform: linux, x86_64, name=nixos, version=24.05 Failed at stage: touchBeginFile Error: ENOENT: no such file or directory, mkdir '/home/ggg/.vscode/extensions/ms-dotnettools.csharp/.razortelemetry' Unable to find extension target platform - no vsix manifest file exists at /home/ggg/.vscode/extensions/ms-dotnettools.csharp/.vsixmanifest Using dotnet configured on PATH Dotnet path: /nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/dotnet Activating C# + C# Dev Kit... waiting for named pipe information from server... [stdout] {"pipeName":"/tmp/164f2272.sock"} received named pipe information from server attempting to connect client to server... client has connected to server [Info - 1:35:46 PM] [Program] Language server initialized [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler.ClassEnumGen/SimpleCompiler.ClassEnumGen.csproj loaded by C# Dev Kit [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler.Cli/SimpleCompiler.Cli.csproj loaded by C# Dev Kit [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/ILPack/src/Lokad.ILPack.csproj loaded by C# Dev Kit [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler.Runtime/SimpleCompiler.Runtime.csproj loaded by C# Dev Kit [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/test/SimpleCompiler.Test.csproj loaded by C# Dev Kit [Info - 1:35:49 PM] [WorkspaceProjectFactoryService] Project /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/SimpleCompiler.csproj loaded by C# Dev Kit Unable to find extension target platform - no vsix manifest file exists at /home/ggg/.vscode/extensions/ms-dotnettools.csharp/.vsixmanifest Using dotnet configured on PATH ```

C# LSP Trace Logs

``` [LanguageServerHost] Found 17 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/MirDebugPrinter.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/Helpers/Reference.cs in SimpleCompiler [LanguageServerHost] Found 3 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/ResultKind.cs in SimpleCompiler [LanguageServerHost] Found 6 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/Emit/ReflectionData.cs in SimpleCompiler [LanguageServerHost] /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs found in workspace Host [LanguageServerHost] [06:24:00.669][Start]textDocument/completion [LanguageServerHost] [06:24:00.675][End]textDocument/completion [LanguageServerHost] /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs found in workspace Host [LanguageServerHost] [06:24:00.680][Start]completionItem/resolve [LanguageServerHost] [06:24:00.688][End]completionItem/resolve [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/UnaryOperationKind.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Internal/FunctionCallExpression.cs in SimpleCompiler [LanguageServerHost] /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs found in workspace Host [LanguageServerHost] [06:24:02.067][Start]completionItem/resolve [LanguageServerHost] /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs found in workspace Host [LanguageServerHost] [06:24:02.389][Start]completionItem/resolve [LanguageServerHost] completionItem/resolve - Canceled [LanguageServerHost] [06:24:02.429][End]completionItem/resolve [LanguageServerHost] [06:24:02.509][End]completionItem/resolve [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Internal/ExpressionStatement.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/MirKind.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Internal/BinaryOperationExpression.cs in SimpleCompiler [LanguageServerHost] Found 2 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/ScopeInfo.cs in SimpleCompiler [LanguageServerHost] Found 13 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/ConstantFolding.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Internal/AssignmentStatement.cs in SimpleCompiler [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Internal/MirNode.cs in SimpleCompiler [LanguageServerHost] /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs found in workspace Host [LanguageServerHost] [06:24:07.900][Start]textDocument/diagnostic [LanguageServerHost] PublicDocumentPullDiagnosticsHandler(category: , source: ) started getting diagnostics [LanguageServerHost] previousResults.Length=1 [LanguageServerHost] Processing 1 documents [LanguageServerHost] Diagnostics were unchanged for DocumentDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/Optimizations/Inliner.cs in SimpleCompiler [LanguageServerHost] Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public.PublicDocumentPullDiagnosticsHandler finished getting diagnostics [LanguageServerHost] [06:24:07.900][End]textDocument/diagnostic [LanguageServerHost] Found 1 diagnostics for FullSolutionAnalysisDiagnosticSource: /home/ggg/Git/GGG-KILLER/SimpleCompiler/src/SimpleCompiler/MIR/MirFactory.cs in SimpleCompiler ```

Environment information

VSCode version: 1.86.0 C# Extension: 2.17.7 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.69afb982 Runtime Environment: OS Name: nixos OS Version: 24.05 OS Platform: Linux RID: linux-x64 Base Path: /nix/store/kyhdj8hg4ha7vfz2g573b0i5fp42s1ry-dotnet-sdk-8.0.101/sdk/8.0.101/ .NET workloads installed: Workload version: 8.0.100-manifests.69afb982 There are no installed workloads to display. Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92 .NET SDKs installed: 6.0.418 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/sdk] 7.0.405 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/sdk] 8.0.101 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.26 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.15 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.26 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.15 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [/nix/store/r9br5wzkgdsw1g6lfqiah4pdf77qnaqg-dotnet-core-combined/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |alejandra|kamadorueda|1.0.0|kamadorueda.alejandra| |csdevkit|ms-dotnettools|1.4.2|ms-dotnettools.csdevkit| |csharp|ms-dotnettools|2.17.7|ms-dotnettools.csharp| |dotenv|mikestead|1.0.1|mikestead.dotenv| |doxdocgen|cschlosser|1.4.0|cschlosser.doxdocgen| |EditorConfig|EditorConfig|0.16.4|editorconfig.editorconfig| |git-graph|mhutchie|1.30.0|mhutchie.git-graph| |gitlens|eamodio|2024.2.404|eamodio.gitlens| |html-entities|christopherstyles|1.1.2|christopherstyles.html-entities| |indent-rainbow|oderwat|8.3.1|oderwat.indent-rainbow| |jupyter|ms-toolsai|2023.2.1000411022|ms-toolsai.jupyter| |l13-diff|L13RARY|1.3.5|l13rary.l13-diff| |latex-workshop|James-Yu|9.18.0|james-yu.latex-workshop| |material-icon-theme|PKief|4.33.0|pkief.material-icon-theme| |nix-env-selector|arrterian|1.0.11|arrterian.nix-env-selector| |nix-ide|jnoortheen|0.2.2|jnoortheen.nix-ide| |powershell|ms-vscode|2024.3.0|ms-vscode.powershell| |python|ms-python|2023.1.10091012|ms-python.python| |remote-containers|ms-vscode-remote|0.341.0|ms-vscode-remote.remote-containers| |remote-ssh|ms-vscode-remote|0.78.0|ms-vscode-remote.remote-ssh| |rust-analyzer|rust-lang|0.3.1697|rust-lang.rust-analyzer| |scriban|xoofx|1.2.1|xoofx.scriban-1.2.1| |shell-format|foxundermoon|7.1.0|foxundermoon.shell-format| |shellcheck|timonwong|0.26.3|timonwong.shellcheck| |t4-support|zbecknell|0.7.0|zbecknell.t4-support-0.7.0| |volar|Vue|1.8.27|vue.volar-1.8.27| |vscode-docker|ms-azuretools|1.28.0|ms-azuretools.vscode-docker| |vscode-dotnet-runtime|ms-dotnettools|1.7.2|ms-dotnettools.vscode-dotnet-runtime-1.7.2| |vscode-ebnf|OMKOV|1.0.5|omkov.vscode-ebnf| |vscode-eslint|dbaeumer|2.4.4|dbaeumer.vscode-eslint| |vscode-github-actions|github|0.26.2|github.vscode-github-actions-0.26.2| |vscode-import-cost|wix|3.3.0|wix.vscode-import-cost| |vscode-ltex|valentjn|13.1.0|valentjn.vscode-ltex| |vscode-yaml|redhat|1.14.0|redhat.vscode-yaml|;

Extension version: 2.17.7 VS Code version: Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937, 2024-01-31T10:27:46.147Z) OS version: Linux x64 6.7.2-lqx2 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 5600X 6-Core Processor (12 x 4600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|62.73GB (28.74GB free)| |Process Argv|--crash-reporter-id cf302e38-285f-4af7-8695-ef4cb495be41| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome-xorg| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome-xorg| |XDG_SESSION_TYPE|x11|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 0bi6i642:30951795 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 accentitlementsc:30887149 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 dsvsc019b:30953937 3ef8e399:30949928 e3gdj431:30958358 ccp1r6:30958156 ```
dibarbet commented 7 months ago

There's a bug with the URI serialization or deserialization - the file scheme is getting added twice

file:///file%3A...

I couldn't repro on windows, trying linux next. For now I'd recommend switching to the release version of the extension.

dibarbet commented 7 months ago

Nevermind, got it to repro on windows. Thanks for the report, I'll take a look.

dibarbet commented 7 months ago

In the meantime, you can downgrade to the release version of the extension 2.15.30 to workaround the issue.

dibarbet commented 7 months ago

Will be fixed in the next prerelease version of the extension.