dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
505 stars 195 forks source link

VSCode raise warning "Found markup element with unexpected name" #5901

Closed m4ss1m0g closed 3 weeks ago

m4ss1m0g commented 2 years ago

Is this a Bug or Feature request?:

Bug

Steps to reproduce

  1. open new terminal and execute dotnet new blazorserver -n Blazor1
  2. Launch VSCode on new created folder
  3. Edit the Pages/Index.razor

Description of the problem:

The <PageTitle> element and <SurveyPrompt> element are not recognized

image

Expected behavior:

The <PageTitle> element and <SurveyPrompt> element are correctly recognized

Actual behavior:

The IntelliSense raise warning

Logs

OmniSharp

Starting OmniSharp server at 25/12/2021, 17:56:54 Target: d:\Developz\Temp\Blazor1

OmniSharp server started. Path: C:/Users/massimo/scoop/apps/omnisharp/current/omnisharp.exe PID: 14200

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    Located 2 MSBuild instance(s)
        1: Visual Studio Enterprise 2019 16.11.31702.278 16.11.0 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
        2: StandAlone 17.0.0 - "C:\Users\massimo\scoop\apps\omnisharp\current\.msbuild\Current\Bin"
    Registered MSBuild instance: Visual Studio Enterprise 2019 16.11.31702.278 16.11.0 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    Detecting Cake files in 'd:\Developz\Temp\Blazor1'.
    Did not find any Cake files
    No solution files found in 'd:\Developz\Temp\Blazor1'
    Queue project update for 'd:\Developz\Temp\Blazor1\Blazor1.csproj'
    Detecting CSX files in 'd:\Developz\Temp\Blazor1'.
    Did not find any CSX files
    Configuration finished.
    Omnisharp server running using Stdio at location 'd:\Developz\Temp\Blazor1' on host 6600.
    Loading project: d:\Developz\Temp\Blazor1\Blazor1.csproj
    Targeting .NET 6.0 in Visual Studio 2019 is not supported.
    Successfully loaded project file 'd:\Developz\Temp\Blazor1\Blazor1.csproj'.

d:\Developz\Temp\Blazor1\Blazor1.csproj C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): Error: Targeting .NET 6.0 in Visual Studio 2019 is not supported.

    Adding project 'd:\Developz\Temp\Blazor1\Blazor1.csproj'
    Failed to add project to workspace: 'd:\Developz\Temp\Blazor1\Blazor1.csproj'
    Could not locate project in workspace: d:\Developz\Temp\Blazor1\Blazor1.csproj
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Counter.razor__virtual.cs added to workspace
    Solution initialized -> queue all documents for code analysis. Initial document count: 1.
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Error.cshtml__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\MainLayout.razor__virtual.cs added to workspace
    ************ Request ************

{ "Type": "request", "Seq": 69, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] }

    ************  Response (28.5175ms) ************ 

{ "Request_seq": 69, "Command": "/filesChanged", "Running": true, "Success": false, "Message": "\"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(Project project, String analyzerConfigFile) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 606\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(ProjectFileInfo projectFileInfo, String analyzerConfigFile, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 572\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Callbacks.Invoke(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.Callbacks.cs:line 22\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Notify(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.cs:line 43\r\n at OmniSharp.Roslyn.CSharp.Services.Files.OnFilesChangedService.Handle(IEnumerable1 requests) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Files\\\\OnFilesChangedService.cs:line 27\\r\\n at OmniSharp.Endpoint.EndpointHandler2.d18.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d20.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 227\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d16.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 138\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Stdio.Host.d14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218\"", "Body": null, "Seq": 116, "Type": "response" }

    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\_Host.cshtml__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\_Layout.cshtml__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Counter.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Error.cshtml__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\NavMenu.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\SurveyPrompt.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\_Imports.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\App.razor__virtual.cs added to workspace
    ************ Request ************

{ "Type": "request", "Seq": 173, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] }

    ************  Response (0.8337ms) ************ 

{ "Request_seq": 173, "Command": "/filesChanged", "Running": true, "Success": false, "Message": "\"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(Project project, String analyzerConfigFile) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 606\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(ProjectFileInfo projectFileInfo, String analyzerConfigFile, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 572\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Callbacks.Invoke(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.Callbacks.cs:line 22\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Notify(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.cs:line 43\r\n at OmniSharp.Roslyn.CSharp.Services.Files.OnFilesChangedService.Handle(IEnumerable1 requests) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Files\\\\OnFilesChangedService.cs:line 27\\r\\n at OmniSharp.Endpoint.EndpointHandler2.d18.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d20.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 227\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d16.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 138\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Stdio.Host.d14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218\"", "Body": null, "Seq": 248, "Type": "response" }

    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\PageTitle.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\PageTitle.razor__virtual.cs added to workspace
    ************ Request ************

{ "Type": "request", "Seq": 207, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] }

    ************  Response (0.7167ms) ************ 

{ "Request_seq": 207, "Command": "/filesChanged", "Running": true, "Success": false, "Message": "\"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(Project project, String analyzerConfigFile) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 606\r\n at OmniSharp.MSBuild.ProjectManager.UpdateAnalyzerConfigFile(ProjectFileInfo projectFileInfo, String analyzerConfigFile, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 572\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Callbacks.Invoke(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.Callbacks.cs:line 22\r\n at OmniSharp.FileWatching.ManualFileSystemWatcher.Notify(String filePath, FileChangeType changeType) in D:\\a\\1\\s\\src\\OmniSharp.Host\\FileWatching\\ManualFileSystemWatcher.cs:line 43\r\n at OmniSharp.Roslyn.CSharp.Services.Files.OnFilesChangedService.Handle(IEnumerable1 requests) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Files\\\\OnFilesChangedService.cs:line 27\\r\\n at OmniSharp.Endpoint.EndpointHandler2.d18.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d20.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 227\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler`2.d16.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 138\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Stdio.Host.d14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218\"", "Body": null, "Seq": 303, "Type": "response" }

    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace
    Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace

Razor

Expand

``` [Client - 18:10:43] -- Starting Issue Data Collection-- [Client - 18:10:45] -- Stopping Issue Data Collection-- ```

Workspace information

Razor document:

Expand

```Razor Non Razor file as active document ```

Projected CSharp document:

Expand

```C# Could not determine CSharp content ```

Projected Html document:

Expand

```Html Could not determine Html content ```

Machine information

VSCode version: 1.63.2 Razor.VSCode version: 1.23.17

dotnet --info

Expand

``` .NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\ Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc .NET SDKs installed: 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.818 [C:\Program Files\dotnet\sdk] 2.2.402 [C:\Program Files\dotnet\sdk] 3.1.403 [C:\Program Files\dotnet\sdk] 3.1.416 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] 5.0.210 [C:\Program Files\dotnet\sdk] 5.0.303 [C:\Program Files\dotnet\sdk] 5.0.401 [C:\Program Files\dotnet\sdk] 5.0.404 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download ```

Extensions

Expand

|Extension|Author|Version| |---|---|---| |auto-using|Fudge|0.7.15| |azure-account|ms-vscode|0.9.11| |azurecli|ms-vscode|0.5.0| |code-settings-sync|Shan|3.4.3| |color-highlight|naumovs|2.5.0| |csharp|ms-dotnettools|1.23.17| |debugger-for-edge|msjsdiag|1.0.15| |docthis|joelday|0.7.1| |dotnet-core-add|solidcube|0.1.2| |dotnet-test-explorer|formulahendry|0.7.7| |eslint-disable-snippets|drKnoxy|1.3.0| |fluent-icons|miguelsolorio|0.0.15| |git-graph|mhutchie|1.30.0| |github-vscode-theme|GitHub|5.1.0| |gitlens|eamodio|11.7.0| |markdown-all-in-one|yzhang|3.4.0| |material-icon-theme|PKief|4.11.0| |msbuild-project-tools|tintoy|0.4.3| |mssql|ms-mssql|1.12.0| |npm-intellisense|christian-kohler|1.4.0| |nugetpackagemanagergui|aliasadidev|1.1.9| |numbered-bookmarks|alefragnani|8.1.0| |output-colorizer|IBM|0.1.2| |powershell|ms-vscode|2021.12.0| |prettier-vscode|esbenp|9.0.0| |project-manager|alefragnani|12.4.0| |rainbow-csv|mechatroner|2.0.0| |remote-containers|ms-vscode-remote|0.209.6| |remote-ssh|ms-vscode-remote|0.70.0| |remote-ssh-edit|ms-vscode-remote|0.70.0| |remote-ssh-explorer|ms-vscode-remote|0.56.0| |remote-wsl|ms-vscode-remote|0.63.13| |test-adapter-converter|ms-vscode|0.1.5| |theme-dracula|dracula-theme|2.24.1| |todo-tree|Gruntfuggly|0.0.214| |trxviewer|scabana|1.0.1| |user-secrets|adrianwilczynski|2.0.1| |vetur|octref|0.35.0| |vsc-community-material-theme|Equinusocio|1.4.2| |vsc-material-theme|Equinusocio|33.1.2| |vscode-docker|ms-azuretools|1.18.0| |vscode-drawio|hediet|1.6.3| |vscode-eslint|dbaeumer|2.2.2| |vscode-import-cost|wix|2.15.0| |vscode-markdownlint|DavidAnson|0.45.0| |vscode-nuget-gallery|patcx|0.0.24| |vscode-nupkg|eridem|1.0.1| |vscode-remote-extensionpack|ms-vscode-remote|0.21.0| |vscode-taskexplorer|spmeesseman|2.5.7| |vscode-theme-onedark|akamud|2.2.3| |vscode-thunder-client|rangav|1.9.1| |vscode-versionlens|pflannery|1.0.9| |vscode-wakatime|WakaTime|18.0.2| |vscode-yaml|redhat|1.2.2| |vscodeintellicode|VisualStudioExptTeam|1.2.15| |vtpw|snovakovic|0.1.2| |Vue2|ducksoupdev|0.1.3| |xml|DotJoshJohnson|2.5.1|;

m4ss1m0g commented 2 years ago

I have found this related dotnet razor tool issue where user says's to delete the obj and the bin folders and rebuild.

pranavkm commented 2 years ago

Does clearing bin and obj fix the issue? Also it looks like O# is throwing a null-ref. Perhaps that's causing design time completion to be incorrect?

ghost commented 2 years ago

Hi @m4ss1m0g. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

m4ss1m0g commented 2 years ago

Does clearing bin and obj fix the issue?

Yes

Also it looks like O# is throwing a null-ref. Perhaps that's causing design time completion to be incorrect?

I don't know

TanayParikh commented 2 years ago

Looks like this may be related to https://github.com/dotnet/razor-tooling/issues/4590.

m4ss1m0g commented 2 years ago

Update

The issue also occurs after some time of coding, to mitigate the issue I delete obj and bin folders and the issue the command dotnet build and restart OmniSharp.

dustinlacewell commented 2 years ago

I'm using vscode, and deleting obj and bin and restarting vscode or omnisharp doesn't resolve the issue for me. I used the blazorserver template.

oyoakwa commented 2 years ago

If you are using vs. Exclude the new file from the project and include it again: this mostly happens with newly created files

NightAngell commented 2 years ago

I had exact same issue is Visual Studio/Visual studio code.

Solution for already broken file a. Visual studio: Right click on broken .razor file -> Properties -> Build Action -> "Content". b. Visual studio code: .csproj file -> Manually remove lines:

  <ItemGroup>
    <Content Remove="PathToComponent\Component.razor" />
  </ItemGroup>

  <ItemGroup>
    <None Include="PathToComponent\Component.razor" />
  </ItemGroup>

If after that change project wont compile, made sure .razor.cs file is partial class.

How to prevent this from happening Visual studio (Communnity 2022 [17.2.5]) keep adding these (b.) to csproj every time I create .razor file. To prevent this I added

  <ItemGroup>
    <Content Include="..\**\*.razor" />
  </ItemGroup>

to .csrpoj file.

lonix1 commented 2 years ago

Environment: linux, vscode, net6, blazor.

In my Razor Class Library that contains blazor components, I get:

Found markup element with unexpected name

and

The attribute names could not be inferred from bind attribute 'bind-Foo'" ...

I used a variation of the workaround above (by @NightAngell) in my .csproj:

<ItemGroup>
  <Content Remove="**/*.razor" />
  <None Include="**/*.razor" />
</ItemGroup>
rm -rf bin obj
dotnet build

...And the problem disappeared! Huh?!

Can someone explain why that works?

UPDATE: doesn't work when there are also Foo.razor.css files ("error BLAZOR102: The scoped css file Foo.razor.css' was defined but no associated razor component or view was found for it.")

UPDATE2: sometimes it works, sometimes it doesn't. The blazor tooling is really really really broken! :rage:

ktravelet commented 1 year ago

I'm trying to create my first MAUI Blazor app and hitting these issues on macOS.

Workarounds above didn't help. Tried deleting obj and bin with rebuilds and nothing helped.

image
ktravelet commented 1 year ago

I was able to get around this by adding @namespace Mobile.Shared to every file in the shared directory. Something buggy is going on.

jjay225 commented 1 year ago

image Using this version of the preview build and my Razor pages are totally buggered, some work, some do, some sometimes work. Deleting the bin and obj folders makes VS recognize a component and it's parameters but if you go into that component it's like looking at your code with Notepad.exe, zero syntax highlighting.

Any news on a fix, better work arounds? We can't even continue our work now. Probably have to system restore or try a different visual studio version 😡

TrieBr commented 1 year ago

I was able to get around this by adding @namespace Mobile.Shared to every file in the shared directory. Something buggy is going on.

Thanks, this seemed to work for me.

I was getting "Found markup element with unexpected name" for a component even right beside my main component, but it couldn't find it for some reason. Adding the @namespace declaration in that file and my shared files seemed to work.

JucianoSilva153 commented 1 year ago

So, i had the same issue, but thanks god after 3h searching i found out that at least in my particular case, the problem was at Nugets packages in the folder .nuget. I delete everything in it, and after that i created a new project and restore ou dependencies. it worked.

Don't forget to install the brand new "C#" extension in the VSCode, i think is part of C# Dev Kit, because we don't know the really cousa of that issue until now... Hope that help anyone!!

marokodev commented 1 year ago

In my case it was the C# extension(ms-dotnettools.csharp). I started seeing the issue after updated from v1.26.0 to v2.0.376. I resolved it by reverting back to v1.26.0

m4ss1m0g commented 12 months ago

Approaching a 2-year birthday without a solution or workaround.

TrieBr commented 12 months ago

The workaround is to use Rider until this extension is usable someday.

micahosborne commented 8 months ago

This issue is the only thing missing for me to be able to use vscode

puppetSpace commented 8 months ago

Just got the same issue. Worked great a couple of days ago and now I get these warnings. Removed obj and bin folders. reinstalled C# dev kit, removed all items from my nuget folder. Nothing helped.

Side by side view: vscode and visualstudio image

celestialvigor commented 7 months ago

@puppetSpace performed same steps as you of course it didn't work. What strangely fixed it was creating the code behind files, as in XComponent.razor.cs: public partial class XComponent {}

At least I can repeat it. If I delete the code behind file and reload vs code, the error reappears. If I then create the file, the error goes away.

kevinhellos commented 7 months ago

@namespace

I am facing the same issue in 3 April 2024

NathanVG commented 7 months ago

Same here

celestialvigor commented 6 months ago

Adding to my previous comment. have your code behind file inherit from the corresponding class. For a normal component for example:

public partial class XComponent : ComponentBase {}

This seems to immediately solve it for me. But you have to do it for every component. You basically need to help out the LS into recognizing the components, whether explicitly stating it in the (razor.cs) or the (razor) file itself.

ryzngard commented 6 months ago

This issue wasn't assigned to anyone and looks to have been missed. For those still hitting the issue, I have some follow up questions:

  1. How frequent is it happening?
  2. Are you using the newest C# extension, and are you also using C# Dev Kit?
  3. Are you using the omnisharp option?
  4. What operating system are you hitting this one?
  5. Can you share logs and/or a solution that you're having this issue with?

In the mean time, I'll assign myself and mark as needs more info until I get a bit more context. We've been busy working on a lot of improvements in the project system area that often results in mass errors like these. Knowing if they have been fixed or are still problematic and at what scope helps us prioritize correctly.

TrieBr commented 6 months ago

@ryzngard I'm not sure if the root cause is the same, but I filed a similar bug with repro steps. In my case it seemed to just stop indexing files after a certain number of files exist in the project even if csharp.maxProjectFileCountForDiagnosticAnalysis was set to unlimited or a high number.

https://github.com/dotnet/vscode-csharp/issues/6921

ryzngard commented 6 months ago

@TrieBr I know we've had issues with linux around the number of file watchers, that may be the culprit for that particular case. It's good to know they might be related. OS is a big factor for some of these

TrieBr commented 6 months ago

Interesting. Does that apply to Mac too? I normally use VSCode on Mac, but I opened my exact project on a Windows VM and my particular issue seem to be fixed or at least less obviously broken.

In this screenshot, the left side is in a Windows VM and the right is Mac. On Mac, notice the yellow squiggly lines. In the case of my PaymentPeriodTransactions, the file exists in the same folder as the file I'm editing so it's even more strange that it's not recognized as a component (on Mac).

Screenshot 2024-04-30 at 7 59 10 PM

EDIT: I managed to break the Windows one by switching to pre-release C# extension (switching back to stable also remains broken now).

ryzngard commented 6 months ago

I managed to break the Windows one by switching to pre-release C# extension (switching back to stable also remains broken now).

Does deleting the obj folder(s) fix this issue? The project information as of now is stored on disk so it may be that the broken state is stale data that needs to be cleaned up. We're working on fixing this in upcoming releases with a larger architecture change but in the meantime doing targeted fixes where we can unblock people

TrieBr commented 6 months ago

Cleaning obj/bin folders on Windows fixed the problem. Doing the same on Mac made the problem worse (none of the components are recognized now). The razor log (on MAC) shows tons of errors like the following:

File '/Path/ToFile/Component.razor' didn't exist in the Razor document list. This is likely because it's from outside the workspace.

razor.provideDynamicFileInfo failed with CodeExpectedError: cannot open virtualCSharp-razor:/Path/ToFile/Component.razorvirtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Path/ToFile/Component.razorvirtual.cs

All of this works on Windows now, but not on Mac for some reason. All of the files are in my workspace.

EDIT: Updating .NET SDK partially fixed the issue, now I'm back at the same state as my previous screenshot (Working on Windows, some components still unrecognized on Mac).

dotnet-policy-service[bot] commented 6 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

Please see our Issue Management Policies for more information.

davidwengier commented 6 months ago

I disagree, Mr Bot, that this issue is stale, andI think it would be a diservice to our customers if you were to close it.

ryzngard commented 6 months ago

Thanks @davidwengier for keeping the bot in line while I was asleep :) . They won't take over just yet

TrieBr commented 6 months ago

I seem to have found a workaround. I changed the association of ".razor" files to just Razor, reloaded VS Code, then switched it back to ASP.NET Razor and reloaded VS Code.

I've been troubleshooting this on the same project across a variety of environments (VSCode Local on MacOS, VSCode Dev Containers (Local Docker on Mac OS), and Codespaces Dev Containers (Linux x86 host) (both connecting from local VS Code and https://vscode.dev)).

I was having trouble getting any of them to work properly, but this trick of switching the file association around fixed the issue in all environments (My C# extension version is pinned at 2.23.15 due to another bug).

All my components are recognized now (for the time being..):

Screenshot 2024-05-10 at 2 22 39 PM

This is a big milestone for me as it is the first time I've been able to get rid of all non-existent errors from the Problems window.

Screenshot 2024-05-10 at 2 37 12 PM
ryzngard commented 6 months ago

I'm very surprised at how that would fix it, but glad it does (for now). Thank you for such detailed comments @TrieBr

kevinhellos commented 6 months ago

✅💡 NEW Working Fix (as of 14 May 2024)

  1. Delete the obj and bin folder
  2. Ensure you add @using yourProjectName.yourFolderName in the _Imports.razor
  3. Close all opened tabs and reopen

From the image below, as you can see the component in the components/ProductCard.razor works just fine without any red squiggly line.

image
TheoLangevin commented 6 months ago

PROBLEM FIXED for me :

I had the same problem with my MudBlazor project in Github ( ApiProjet + Client-SideProject in same folder ) The problem was due to the .sln in VSCode because it was link to the parents repository and was generated juste one time for the two App. 👎

SOLUTION : Open alone the two apps folder ( not the parent folder ) and then the .sln is generated for both and error is gone.

ryzngard commented 3 weeks ago

This should be fixed in v2.50.25 and higher.

had the same problem with my MudBlazor project in Github ( ApiProjet + Client-SideProject in same folder )

When you say "in Github" I'm not sure I follow. Are you talking about Codespaces? If so we have a separate issue tracking https://github.com/dotnet/razor/issues/10735