dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

Extension continually fails with 'Profile.cs' is not open #7465

Closed jonathaneckman closed 3 months ago

jonathaneckman commented 3 months ago

Environment information

VSCode version: 1.92.2 C# Extension: 2.44.19 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.204 Commit: c338c7548c Workload version: 8.0.200-manifests.9f663350 Runtime Environment: OS Name: Mac OS X OS Version: 14.6 OS Platform: Darwin RID: osx-arm64 Base Path: /usr/local/share/dotnet/sdk/8.0.204/ .NET workloads installed: There are no installed workloads to display. Host: Version: 8.0.4 Architecture: arm64 Commit: 2d7eea2529 .NET SDKs installed: 6.0.407 [/usr/local/share/dotnet/sdk] 6.0.408 [/usr/local/share/dotnet/sdk] 6.0.410 [/usr/local/share/dotnet/sdk] 6.0.412 [/usr/local/share/dotnet/sdk] 7.0.202 [/usr/local/share/dotnet/sdk] 7.0.203 [/usr/local/share/dotnet/sdk] 7.0.302 [/usr/local/share/dotnet/sdk] 7.0.304 [/usr/local/share/dotnet/sdk] 7.0.306 [/usr/local/share/dotnet/sdk] 8.0.204 [/usr/local/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.4 [/usr/local/share/dotnet/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| |---|---|---|---| |auto-rename-tag|formulahendry|0.1.10|formulahendry.auto-rename-tag-0.1.10| |azure-account|ms-vscode|0.12.0|ms-vscode.azure-account-0.12.0| |azure-dev|ms-azuretools|0.8.3|ms-azuretools.azure-dev-0.8.3| |azure-pipelines|ms-azure-devops|1.228.0|ms-azure-devops.azure-pipelines-1.228.0| |azurite|Azurite|3.32.0|azurite.azurite-3.32.0| |code-spell-checker|streetsidesoftware|3.0.1|streetsidesoftware.code-spell-checker-3.0.1| |copilot|GitHub|1.223.0|github.copilot-1.223.0| |copilot-chat|GitHub|0.18.2|github.copilot-chat-0.18.2| |csdevkit|ms-dotnettools|1.10.10|ms-dotnettools.csdevkit-1.10.10-darwin-arm64| |csharp|ms-dotnettools|2.44.19|ms-dotnettools.csharp-2.44.19-darwin-arm64| |csharpier-vscode|csharpier|1.8.0|csharpier.csharpier-vscode-1.8.0| |docomment|k--kato|1.0.0|k--kato.docomment-1.0.0| |githistory|donjayamanne|0.6.20|donjayamanne.githistory-0.6.20| |intellicode-api-usage-examples|VisualStudioExptTeam|0.2.8|visualstudioexptteam.intellicode-api-usage-examples-0.2.8| |markdown-all-in-one|yzhang|3.6.2|yzhang.markdown-all-in-one-3.6.2| |markdown-footnotes|bierner|0.1.1|bierner.markdown-footnotes-0.1.1| |markdown-table-formatter|fcrespo82|3.0.0|fcrespo82.markdown-table-formatter-3.0.0| |openfga-vscode|openfga|0.2.22|openfga.openfga-vscode-0.2.22| |powershell|ms-vscode|2024.2.2|ms-vscode.powershell-2024.2.2| |prettier-vscode|esbenp|11.0.0|esbenp.prettier-vscode-11.0.0| |rainbow-csv|mechatroner|3.12.0|mechatroner.rainbow-csv-3.12.0| |remote-containers|ms-vscode-remote|0.380.0|ms-vscode-remote.remote-containers-0.380.0| |terraform|hashicorp|2.32.2|hashicorp.terraform-2.32.2-darwin-arm64| |turbo-vsc|Vercel|2.0.0|vercel.turbo-vsc-2.0.0| |vscode-azureappservice|ms-azuretools|0.25.3|ms-azuretools.vscode-azureappservice-0.25.3| |vscode-azurecontainerapps|ms-azuretools|0.7.0|ms-azuretools.vscode-azurecontainerapps-0.7.0| |vscode-azurefunctions|ms-azuretools|1.15.3|ms-azuretools.vscode-azurefunctions-1.15.3| |vscode-azureresourcegroups|ms-azuretools|0.9.2|ms-azuretools.vscode-azureresourcegroups-0.9.2| |vscode-azurestaticwebapps|ms-azuretools|0.12.2|ms-azuretools.vscode-azurestaticwebapps-0.12.2| |vscode-azurestorage|ms-azuretools|0.16.1|ms-azuretools.vscode-azurestorage-0.16.1| |vscode-azurevirtualmachines|ms-azuretools|0.6.5|ms-azuretools.vscode-azurevirtualmachines-0.6.5| |vscode-cosmosdb|ms-azuretools|0.22.0|ms-azuretools.vscode-cosmosdb-0.22.0| |vscode-docker|ms-azuretools|1.29.2|ms-azuretools.vscode-docker-1.29.2| |vscode-dotnet-runtime|ms-dotnettools|2.1.5|ms-dotnettools.vscode-dotnet-runtime-2.1.5| |vscode-eslint|dbaeumer|3.0.10|dbaeumer.vscode-eslint-3.0.10| |vscode-expo-tools|expo|1.5.0|expo.vscode-expo-tools-1.5.0| |vscode-markdownlint|DavidAnson|0.55.0|davidanson.vscode-markdownlint-0.55.0| |vscode-mdx|unifiedjs|1.8.10|unifiedjs.vscode-mdx-1.8.10| |vscode-node-azure-pack|ms-vscode|1.2.0|ms-vscode.vscode-node-azure-pack-1.2.0| |vscode-tailwindcss|bradlc|0.12.7|bradlc.vscode-tailwindcss-0.12.7| |vscodeintellicode|VisualStudioExptTeam|1.3.1|visualstudioexptteam.vscodeintellicode-1.3.1| |vscodeintellicode-csharp|ms-dotnettools|2.1.11|ms-dotnettools.vscodeintellicode-csharp-2.1.11-darwin-arm64|;

Steps to reproduce

I have the extension installed and am authoring C# files. The extension will fail with the error below intermittently (roughly every 10 mins). I have to reload VS code to fix it.

[Error - 5:44:35 PM] [LanguageServerHost] System.ArgumentException: 'Profile.cs' is not open.
   at Microsoft.CodeAnalysis.Workspace.CheckDocumentIsOpen(DocumentId documentId) in /_/src/Workspaces/Core/Portable/Workspace/Workspace_Editor.cs:line 345
   at Microsoft.CodeAnalysis.Workspace.<>c.<OnDocumentClosedEx>b__213_0(Solution oldSolution, ValueTuple`4 data) in /_/src/Workspaces/Core/Portable/Workspace/Workspace_Editor.cs:line 676
   at Microsoft.CodeAnalysis.Workspace.SetCurrentSolutionAsync[TData](Boolean useAsync, TData data, Func`3 transformation, Boolean mayRaiseEvents, Action`3 onBeforeUpdate, Action`3 onAfterUpdate, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 511
   at Roslyn.Utilities.ValueTaskExtensions.VerifyCompleted[T](ValueTask`1 task, String message) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ValueTaskExtensions.cs:line 21
   at Microsoft.CodeAnalysis.Workspace.SetCurrentSolution[TData](TData data, Func`3 transformation, Boolean mayRaiseEvents, Action`3 onBeforeUpdate, Action`3 onAfterUpdate) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 472
   at Microsoft.CodeAnalysis.Workspace.OnDocumentClosedEx(DocumentId documentId, TextLoader reloader, Boolean requireDocumentPresentAndOpen) in /_/src/Workspaces/Core/Portable/Workspace/Workspace_Editor.cs:line 650
   at Microsoft.CodeAnalysis.PdbSourceDocument.PdbSourceDocumentMetadataAsSourceFileProvider.TryRemoveDocumentFromWorkspace(MetadataAsSourceWorkspace workspace, String filePath) in /_/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs:line 378
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceFileService.TryRemoveDocumentFromWorkspace(String filePath) in /_/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs:line 203
   at Microsoft.CodeAnalysis.LanguageServer.LspMiscellaneousFilesWorkspace.TryRemoveMiscellaneousDocument(Uri uri, Boolean removeFromMetadataWorkspace) in /_/src/LanguageServer/Protocol/Workspaces/LspMiscellaneousFilesWorkspace.cs:line 80
   at Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceManager.StopTrackingAsync(Uri uri, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs:line 199
   at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges.DidCloseHandler.HandleNotificationAsync(DidCloseTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs:line 36
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 199
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 241
   at Microsoft.CodeAnalysis.LanguageServer.RoslynRequestExecutionQueue.WrapStartRequestTaskAsync(Task nonMutatingRequestTask, Boolean rethrowExceptions) in /_/src/LanguageServer/Protocol/RoslynRequestExecutionQueue.cs:line 40
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueCoreAsync[TRequest,TResponse](IQueueItem`1 work, IMethodHandler handler, RequestHandlerMetadata metadata, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 349
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.InvokeProcessCoreAsync(IQueueItem`1 work, RequestHandlerMetadata metadata, IMethodHandler handler, MethodInfo methodInfo, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 302
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync() in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 254
[Info  - 5:44:35 PM] Error processing queue, shutting down
[Error - 5:44:35 PM] Workspace diagnostic pull failed.
JoeRobich commented 3 months ago

@jonathaneckman Thanks for opening this issue. This is resolved in https://github.com/dotnet/roslyn/pull/74862. It will be part of the next prerelease. I will comment back once it is available.

dibarbet commented 3 months ago

Should be fixed in the 2.45.17 prerelease version.