dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.58k stars 10.06k forks source link

Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions' #59149

Open JohnGalt1717 opened 11 months ago

JohnGalt1717 commented 11 months ago

Type: Bug

Issue Description

I'm constantly getting this error after opening a project.

Steps to Reproduce

Open C# project.

Expected Behavior

Should work without error

Actual Behavior

Throws error with popup and in the C# output. Won't follow any links, errors, warnings, or lookup implmentations etc.

Logs

C# log

Post the output from Output-->C# here

[Error - 2:58:36 PM] [LanguageServerHost] System.InvalidOperationException: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'. at Microsoft.AspNetCore.App.Analyzers.Infrastructure.WellKnownTypes.GetAndCache(Int32 index) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.CalculateHttpMethods(WellKnownTypes wellKnownTypes, IMethodSymbol mapMethodSymbol) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.BuildContext(RouteOptions routeOptions, SyntaxToken token, SemanticModel semanticModel, WellKnownTypes wellKnownTypes, CancellationToken cancellationToken) at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.<>c__DisplayClass6_0.b_0(SyntaxToken token) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.GetAndCache(SyntaxToken syntaxToken, CancellationToken cancellationToken) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.RoutePatternClassifier.RegisterClassifications(AspNetCoreEmbeddedLanguageClassificationContext context) at Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages.AspNetCoreEmbeddedLanguageClassifier.RegisterClassifications(EmbeddedLanguageClassificationContext context) in //src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs:line 37 at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.ClassifyToken(SyntaxToken token) in //src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs:line 121 at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.VisitTokens(SyntaxNode node) in //src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs:line 104 at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassifications(SolutionServices services, Project project, SemanticModel semanticModel, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) in //src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs:line 59 at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) in //src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs:line 45 at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddClassificationsInCurrentProcessAsync(Document document, ImmutableArray1 textSpans, ClassificationType type, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) in //src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs:line 172 at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddClassificationsAsync(Document document, ImmutableArray1 textSpans, ClassificationOptions options, ClassificationType type, SegmentedList1 result, CancellationToken cancellationToken) in //src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs:line 98 at Microsoft.CodeAnalysis.Classification.ClassifierHelper.GetClassifiedSpansAsync(Document document, ImmutableArray1 spans, ClassificationOptions options, Boolean includeAdditiveSpans, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Classification/ClassifierHelper.cs:line 95 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.GetClassifiedSpansForDocumentAsync(SegmentedList1 classifiedSpans, Document document, ImmutableArray1 textSpans, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 128 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(ClientCapabilities capabilities, Document document, Range[] ranges, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 104 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 64 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 47 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 176 [Error - 2:58:36 PM] Request textDocument/semanticTokens/range failed. Message: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'. Code: -32000

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

VSCode version: 1.85.1 C# Extension: 2.14.8 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.100 Commit: 57efcf1350 Workload version: 8.0.100-manifests.71b9f198 Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100\ .NET workloads installed: Workload version: 8.0.100-manifests.71b9f198 [aspire] Installation Source: SDK 8.0.100, VS 17.9.34321.82 Manifest Version: 8.0.0-preview.1.23557.2/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0-preview.1.23557.2\WorkloadManifest.json Install Type: Msi [maui-windows] Installation Source: VS 17.8.34330.188 Manifest Version: 8.0.3/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.3\WorkloadManifest.json Install Type: Msi [maccatalyst] Installation Source: VS 17.8.34330.188 Manifest Version: 17.0.8478/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.0.8478\WorkloadManifest.json Install Type: Msi [ios] Installation Source: VS 17.8.34330.188 Manifest Version: 17.0.8478/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.0.8478\WorkloadManifest.json Install Type: Msi [android] Installation Source: VS 17.8.34330.188 Manifest Version: 34.0.43/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.43\WorkloadManifest.json Install Type: Msi Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71 .NET SDKs installed: 6.0.417 [C:\Program Files\dotnet\sdk] 7.0.404 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] 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| |---|---|---|---| |andromeda|EliverLara|1.8.1|eliverlara.andromeda-1.8.1| |azure-account|ms-vscode|0.11.6|ms-vscode.azure-account-0.11.6| |azurecli|ms-vscode|0.5.0|ms-vscode.azurecli-0.5.0| |best-dark-themes-pack|thegeoffstevens|1.0.2|thegeoffstevens.best-dark-themes-pack-1.0.2| |blazorwasm-companion|ms-dotnettools|1.1.4|ms-dotnettools.blazorwasm-companion-1.1.4| |csdevkit|ms-dotnettools|1.1.16|ms-dotnettools.csdevkit-1.1.16-win32-x64| |csharp|ms-dotnettools|2.14.8|ms-dotnettools.csharp-2.14.8-win32-x64| |docomment|k--kato|1.0.0|k--kato.docomment-1.0.0| |dotnet|formulahendry|0.0.4|formulahendry.dotnet-0.0.4| |dotnet-interactive-vscode|ms-dotnettools|1.0.4611010|ms-dotnettools.dotnet-interactive-vscode-1.0.4611010| |dotnet-test-explorer|formulahendry|0.7.8|formulahendry.dotnet-test-explorer-0.7.8| |EditorConfig|EditorConfig|0.16.4|editorconfig.editorconfig-0.16.4| |file-downloader|mindaro-dev|1.0.13|mindaro-dev.file-downloader-1.0.13| |git-autoconfig|shyykoserhiy|0.0.2|shyykoserhiy.git-autoconfig-0.0.2| |githistory|donjayamanne|0.6.20|donjayamanne.githistory-0.6.20| |gitlens|eamodio|14.6.0|eamodio.gitlens-14.6.0| |hexeditor|ms-vscode|1.9.12|ms-vscode.hexeditor-1.9.12| |intellicode-api-usage-examples|VisualStudioExptTeam|0.2.8|visualstudioexptteam.intellicode-api-usage-examples-0.2.8| |js-debug-nightly|ms-vscode|2023.12.1317|ms-vscode.js-debug-nightly-2023.12.1317| |jupyter|ms-toolsai|2023.11.1003402403|ms-toolsai.jupyter-2023.11.1003402403-win32-x64| |material-icon-theme|PKief|4.32.0|pkief.material-icon-theme-4.32.0| |material-palenight-theme|whizkydee|2.0.3|whizkydee.material-palenight-theme-2.0.3| |material-theme|zhuangtongfa|3.16.2|zhuangtongfa.material-theme-3.16.2| |ms-teams-vscode-extension|TeamsDevApp|5.2.0|teamsdevapp.ms-teams-vscode-extension-5.2.0| |msbuild-project-tools|tintoy|0.5.3|tintoy.msbuild-project-tools-0.5.3| |ngrok-for-vscode|philnash|1.10.1|philnash.ngrok-for-vscode-1.10.1| |night-owl|sdras|2.0.1|sdras.night-owl-2.0.1| |nord-visual-studio-code|arcticicestudio|0.19.0|arcticicestudio.nord-visual-studio-code-0.19.0| |one-monokai|azemoh|0.5.0|azemoh.one-monokai-0.5.0| |powershell|ms-vscode|2023.8.0|ms-vscode.powershell-2023.8.0| |prettier-vscode|esbenp|10.1.0|esbenp.prettier-vscode-10.1.0| |proto|peterj|0.0.4|peterj.proto-0.0.4| |remote-containers|ms-vscode-remote|0.327.0|ms-vscode-remote.remote-containers-0.327.0| |remote-explorer|ms-vscode|0.4.1|ms-vscode.remote-explorer-0.4.1| |remote-repositories|ms-vscode|0.40.0|ms-vscode.remote-repositories-0.40.0| |remote-server|ms-vscode|1.5.0|ms-vscode.remote-server-1.5.0| |remote-ssh|ms-vscode-remote|0.107.1|ms-vscode-remote.remote-ssh-0.107.1| |remote-ssh-edit|ms-vscode-remote|0.86.0|ms-vscode-remote.remote-ssh-edit-0.86.0| |remote-wsl|ms-vscode-remote|0.81.8|ms-vscode-remote.remote-wsl-0.81.8| |remotehub|GitHub|0.62.0|github.remotehub-0.62.0| |resxpress|PrateekMahendrakar|5.6.0|prateekmahendrakar.resxpress-5.6.0| |se-csproj-extensions|selcukermaya|0.0.7|selcukermaya.se-csproj-extensions-0.0.7| |theme-cobalt2|wesbos|2.4.3|wesbos.theme-cobalt2-2.4.3| |theme-dracula|dracula-theme|2.24.3|dracula-theme.theme-dracula-2.24.3| |todo-tree|Gruntfuggly|0.0.226|gruntfuggly.todo-tree-0.0.226| |user-secrets|adrianwilczynski|2.0.1|adrianwilczynski.user-secrets-2.0.1| |visual-nuget|fullstackspider|0.2.1|fullstackspider.visual-nuget-0.2.1| |vscode-aks-tools|ms-kubernetes-tools|1.3.17|ms-kubernetes-tools.vscode-aks-tools-1.3.17| |vscode-docker|ms-azuretools|1.28.0|ms-azuretools.vscode-docker-1.28.0| |vscode-dotnet-runtime|ms-dotnettools|2.0.0|ms-dotnettools.vscode-dotnet-runtime-2.0.0| |vscode-edge-devtools|ms-edgedevtools|2.1.3|ms-edgedevtools.vscode-edge-devtools-2.1.3| |vscode-env|IronGeek|0.1.0|irongeek.vscode-env-0.1.0| |vscode-firefox-debug|firefox-devtools|2.9.10|firefox-devtools.vscode-firefox-debug-2.9.10| |vscode-github-actions|github|0.26.2|github.vscode-github-actions-0.26.2| |vscode-icons|vscode-icons-team|12.6.0|vscode-icons-team.vscode-icons-12.6.0| |vscode-jupyter-cell-tags|ms-toolsai|0.1.8|ms-toolsai.vscode-jupyter-cell-tags-0.1.8| |vscode-jupyter-slideshow|ms-toolsai|0.1.5|ms-toolsai.vscode-jupyter-slideshow-0.1.5| |vscode-kubernetes-tools|ms-kubernetes-tools|1.3.15|ms-kubernetes-tools.vscode-kubernetes-tools-1.3.15| |vscode-markdownlint|DavidAnson|0.53.0|davidanson.vscode-markdownlint-0.53.0| |vscode-nuget-gallery|patcx|0.0.24|patcx.vscode-nuget-gallery-0.0.24| |vscode-peacock|johnpapa|4.2.2|johnpapa.vscode-peacock-4.2.2| |vscode-pull-request-github|GitHub|0.78.1|github.vscode-pull-request-github-0.78.1| |vscode-remote-extensionpack|ms-vscode-remote|0.25.0|ms-vscode-remote.vscode-remote-extensionpack-0.25.0| |vscode-resx-editor|DominicVonk|0.0.5|dominicvonk.vscode-resx-editor-0.0.5| |vscode-tailwindcss|bradlc|0.10.3|bradlc.vscode-tailwindcss-0.10.3| |vscode-theme-darcula|rokoroku|1.2.3|rokoroku.vscode-theme-darcula-1.2.3| |vscode-versionlens|pflannery|1.9.2|pflannery.vscode-versionlens-1.9.2| |vscode-xml|redhat|0.26.1|redhat.vscode-xml-0.26.1-win32-x64| |vscode-yaml|redhat|1.14.0|redhat.vscode-yaml-1.14.0| |vscodeintellicode-csharp|ms-dotnettools|0.1.26|ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64| |xml|DotJoshJohnson|2.5.1|dotjoshjohnson.xml-2.5.1|;

Extension version: 2.14.8 VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen Threadripper 3960X 24-Core Processor (48 x 3800)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|63.88GB (10.32GB free)| |Process Argv|--file-uri file:///e%3A/Repos/pltfrmd/services/pltfrmd-services.code-workspace --crash-reporter-id 1a49d936-e016-488a-a843-8965f36fd075| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 py29gd2263:30899288 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 2e4cg342:30602488 89544117:30613380 showlangstatbar:30737416 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 welcomedialogc:30910334 pythonnosmt12:30797651 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 dsvsc013:30795093 dsvsc014:30804076 dsvsc015:30845448 pythontestfixt:30902429 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:30885898 pythontbext0:30879054 accentitlementsc:30887149 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 aa_t_chat:30882232 ```
dibarbet commented 11 months ago

Definitely related to https://github.com/dotnet/roslyn/pull/70927

@JohnGalt1717 would you mind providing a little more info

  1. The full C# output window logs, preferably with dotnet.server.trace set to Trace in vscode settings. If you don't want to share publicly, feel free to email them to me directly (listed on my profile)
  2. If you're able to share any more details about the project being loaded (what kind of project template, what target framework its using, etc)

@JamesNK any initial thoughts on what might be going wrong here? Potentially a mismatch somehow between the analyzer being loaded and the versions of the aspnet core libraries?

michaelrp commented 11 months ago

This has been an ongoing issue for me as well. Same versions of VS Code, C# Dev Kit, and C# Extension. Often accompanied by Request textDocument/hover failed. It's a Blazor WASM project, .NET 7.0 (though 8.0 SDK installed).

JohnGalt1717 commented 11 months ago

Oddly, if I open the same project in VS.net 2022 Preview, it gets the same error. This may not be related to VS Code as I thought.

StreamJsonRpc.RemoteInvocationException: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'. at StreamJsonRpc.JsonRpc.d1511.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask1.get_Result() at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection1.<TryInvokeAsync>d__201.MoveNext() RPC server exception: System.InvalidOperationException: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'. at Microsoft.AspNetCore.App.Analyzers.Infrastructure.WellKnownTypes.GetAndCache(Int32 index) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.CalculateHttpMethods(WellKnownTypes wellKnownTypes, IMethodSymbol mapMethodSymbol) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.BuildContext(RouteOptions routeOptions, SyntaxToken token, SemanticModel semanticModel, WellKnownTypes wellKnownTypes, CancellationToken cancellationToken) at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.<>c__DisplayClass6_0.b0(SyntaxToken token) at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.GetAndCache(SyntaxToken syntaxToken, CancellationToken cancellationToken) at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.RoutePatternClassifier.RegisterClassifications(AspNetCoreEmbeddedLanguageClassificationContext context) at Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages.AspNetCoreEmbeddedLanguageClassifier.RegisterClassifications(EmbeddedLanguageClassificationContext context) at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.ClassifyToken(SyntaxToken token) at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.ProcessToken(SyntaxToken token) at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.VisitTokens(SyntaxNode node) at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassifications(SolutionServices services, Project project, SemanticModel semanticModel, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddClassificationsInCurrentProcessAsync(Document document, ImmutableArray1 textSpans, ClassificationType type, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationService.<>cDisplayClass20_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>cDisplayClass9_0`1.<gProcessSolutionAsync|1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunServiceImplAsync[T](Func2 implementation, CancellationToken cancellationToken)

NicklausBrain commented 10 months ago

Same issue. Dotnet 8.0.101. Blazor. Mac os. Vs code 1.85.2

CosmoScriv commented 10 months ago

As a less than perfect workaround I find that closing the folder and reloading the same folder again eliminates the issue for an indeterminate length of time. Sometimes as long as four hours but other times as short as 15 minutes. Maybe this can also offer a clue and help with reproducing. In my case these pop up’s don’t start to appear immediately.

Asdfg75 commented 9 months ago

I am getting the same issue. The constant notifications are a real pain almost every key stroke once they start coming. If they could go away I could manage. I tried turning off C# notifications via the gear in the notification message, but still get the notification. I would guess that setting only covers general notifications, but not errors. How can I help solve this? I am new to this process, but want to contribute to a solution. Can you point me to source of notification. I could work back from there. If you beat me to a solution we all win.

garrettlondon1 commented 8 months ago

@Asdfg75 I have created a separate issue for this here: dotnet/vscode-csharp#6977

bpsc-wkubis commented 7 months ago

I'm experiencing the same issue, Intellisense stops working after a this notification appears. It's quite frustrating because I have to visit every Razor component to reactivate correct Intellisense every time I reload the project (this is propably another issue related to razor/vscode). I've noticed that this issue often correlates with version control. Specifically, when I open file changes and then edit the file, this notification triggers.

jcatalaamat commented 7 months ago

Same, I have to close VS Code and reopen

riffy commented 6 months ago

Same issue here, disabled all extensions except C# on my Windows machine using .Net8 Blazor SSR

Error occurs when, as soon as a .razor file has a reference to another Razor component with Parameters, e.g.

<LTECard Title="A Title">
</LTECard>

in the following circumstances:

dibarbet commented 6 months ago

Summary: seems to be inconsistent error in the route embedded language feature, both in VS and VSCode. Stack trace

StreamJsonRpc.RemoteInvocationException: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'.
at StreamJsonRpc.JsonRpc.d__1511.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask1.get_Result()
at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection1.<TryInvokeAsync>d__201.MoveNext()
RPC server exception:
System.InvalidOperationException: Failed to resolve well-known type 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions'.
at Microsoft.AspNetCore.App.Analyzers.Infrastructure.WellKnownTypes.GetAndCache(Int32 index)
at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.CalculateHttpMethods(WellKnownTypes wellKnownTypes, IMethodSymbol mapMethodSymbol)
at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.Infrastructure.RouteUsageDetector.BuildContext(RouteOptions routeOptions, SyntaxToken token, SemanticModel semanticModel, WellKnownTypes wellKnownTypes, CancellationToken cancellationToken)
at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.<>c__DisplayClass6_0.b__0(SyntaxToken token)
at Microsoft.AspNetCore.App.Analyzers.Infrastructure.RouteUsageCache.GetAndCache(SyntaxToken syntaxToken, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Analyzers.RouteEmbeddedLanguage.RoutePatternClassifier.RegisterClassifications(AspNetCoreEmbeddedLanguageClassificationContext context)
at Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages.AspNetCoreEmbeddedLanguageClassifier.RegisterClassifications(EmbeddedLanguageClassificationContext context)
at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.ClassifyToken(SyntaxToken token)
at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.ProcessToken(SyntaxToken token)
at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.Worker.VisitTokens(SyntaxNode node)
at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassifications(SolutionServices services, Project project, SemanticModel semanticModel, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Classification.AbstractEmbeddedLanguageClassificationService.AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray1 textSpans, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddClassificationsInCurrentProcessAsync(Document document, ImmutableArray1 textSpans, ClassificationType type, ClassificationOptions options, SegmentedList1 result, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationService.<>c__DisplayClass20_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass9_01.<<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func2 implementation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunServiceImplAsync[T](Func`2 implementation, CancellationToken cancellationToken)
dibarbet commented 6 months ago

Same issue here, disabled all extensions except C# on my Windows machine using .Net8 Blazor SSR

Error occurs when, as soon as a .razor file has a reference to another Razor component with Parameters, e.g.

<LTECard Title="A Title">
</LTECard>

in the following circumstances:

  • Hovering an embedded razor component
  • Typing in the @code { } (assume autocomplete does something wrong here)

Razor issues with semantic tokens are tracked here - https://github.com/dotnet/razor/issues/9598

CyrusNajmabadi commented 4 days ago

Thi sis not roslyn. ASP.net owns the RouteEmbeddedLanguage.