razor icon indicating copy to clipboard operation
razor copied to clipboard

VSCode raise warning "Found markup element with unexpected name"

Open m4ss1m0g opened this issue 3 years ago • 37 comments

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) info: OmniSharp.Services.DotNetCliService Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK info: OmniSharp.Services.DotNetCliService Using the 'dotnet' on the PATH. info: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet info: OmniSharp.MSBuild.Discovery.MSBuildLocator 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" info: OmniSharp.MSBuild.Discovery.MSBuildLocator 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" info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 info: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in 'd:\Developz\Temp\Blazor1'. info: OmniSharp.Cake.CakeProjectSystem Did not find any Cake files info: OmniSharp.MSBuild.ProjectSystem No solution files found in 'd:\Developz\Temp\Blazor1' info: OmniSharp.MSBuild.ProjectManager Queue project update for 'd:\Developz\Temp\Blazor1\Blazor1.csproj' info: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in 'd:\Developz\Temp\Blazor1'. info: OmniSharp.Script.ScriptProjectSystem Did not find any CSX files info: OmniSharp.WorkspaceInitializer Configuration finished. info: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location 'd:\Developz\Temp\Blazor1' on host 6600. info: OmniSharp.MSBuild.ProjectManager Loading project: d:\Developz\Temp\Blazor1\Blazor1.csproj [warn]: OmniSharp.MSBuild.ProjectLoader Targeting .NET 6.0 in Visual Studio 2019 is not supported. info: OmniSharp.MSBuild.ProjectManager 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' [fail]: OmniSharp.MSBuild.ProjectManager Failed to add project to workspace: 'd:\Developz\Temp\Blazor1\Blazor1.csproj' [fail]: OmniSharp.MSBuild.ProjectManager Could not locate project in workspace: d:\Developz\Temp\Blazor1\Blazor1.csproj info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Counter.razor__virtual.cs added to workspace info: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers Solution initialized -> queue all documents for code analysis. Initial document count: 1. info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Error.cshtml__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\MainLayout.razor__virtual.cs added to workspace [warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 69, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] } [fail]: OmniSharp.Stdio.Host ************ 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.<AggregateResponsesFromLanguageHandlers>d__18.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.EndpointHandler2.<HandleRequestForLanguage>d__20.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.EndpointHandler2.<Process>d__16.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.<HandleRequest>d__14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218"", "Body": null, "Seq": 116, "Type": "response" } info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages_Host.cshtml__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages_Layout.cshtml__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Counter.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Error.cshtml__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\NavMenu.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Shared\SurveyPrompt.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1_Imports.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\App.razor__virtual.cs added to workspace [warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 173, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] } [fail]: OmniSharp.Stdio.Host ************ 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.<AggregateResponsesFromLanguageHandlers>d__18.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.EndpointHandler2.<HandleRequestForLanguage>d__20.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.EndpointHandler2.<Process>d__16.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.<HandleRequest>d__14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218"", "Body": null, "Seq": 248, "Type": "response" } info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\PageTitle.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\PageTitle.razor__virtual.cs added to workspace [warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 207, "Command": "/filesChanged", "Arguments": [ { "FileName": "d:\Developz\Temp\Blazor1\obj\Debug\net6.0\Blazor1.GeneratedMSBuildEditorConfig.editorconfig", "changeType": "Change" } ] } [fail]: OmniSharp.Stdio.Host ************ 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.<AggregateResponsesFromLanguageHandlers>d__18.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.EndpointHandler2.<HandleRequestForLanguage>d__20.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.EndpointHandler2.<Process>d__16.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.<HandleRequest>d__14.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218"", "Body": null, "Seq": 303, "Type": "response" } info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\FetchData.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace Miscellaneous file: d:\Developz\Temp\Blazor1\Pages\Index.razor__virtual.cs added to workspace info: OmniSharp.OmniSharpWorkspace 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

Non Razor file as active document

Projected CSharp document:

Expand

Could not determine CSharp content

Projected Html document:

Expand

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 avatar Dec 25 '21 17:12 m4ss1m0g

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

m4ss1m0g avatar Dec 25 '21 17:12 m4ss1m0g

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?

pranavkm avatar Dec 26 '21 16:12 pranavkm

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.

ghost avatar Dec 26 '21 16:12 ghost

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

m4ss1m0g avatar Dec 26 '21 16:12 m4ss1m0g

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

TanayParikh avatar Dec 27 '21 15:12 TanayParikh

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.

m4ss1m0g avatar Dec 29 '21 19:12 m4ss1m0g

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.

dustinlacewell avatar Jan 23 '22 11:01 dustinlacewell

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

oyoakwa avatar Jun 09 '22 08:06 oyoakwa

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.

NightAngell avatar Jun 26 '22 08:06 NightAngell

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:

lonix1 avatar Oct 05 '22 06:10 lonix1

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 avatar Jan 01 '23 18:01 ktravelet

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

ktravelet avatar Jan 01 '23 19:01 ktravelet

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 😡

jjay225 avatar Jan 30 '23 13:01 jjay225

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.

TrieBr avatar Jun 08 '23 15:06 TrieBr

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!!

JucianoSilva153 avatar Jun 24 '23 00:06 JucianoSilva153

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

marokodev avatar Aug 21 '23 02:08 marokodev

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

m4ss1m0g avatar Nov 23 '23 17:11 m4ss1m0g

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

TrieBr avatar Nov 23 '23 19:11 TrieBr

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

micahosborne avatar Feb 25 '24 17:02 micahosborne

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

puppetSpace avatar Mar 04 '24 10:03 puppetSpace

@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.

celestialvigor avatar Mar 31 '24 07:03 celestialvigor

@namespace

I am facing the same issue in 3 April 2024

kevinhellos avatar Apr 03 '24 16:04 kevinhellos

Same here

NathanVG avatar Apr 05 '24 15:04 NathanVG

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.

celestialvigor avatar Apr 28 '24 06:04 celestialvigor

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.

ryzngard avatar May 01 '24 01:05 ryzngard

@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

TrieBr avatar May 01 '24 01:05 TrieBr

@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

ryzngard avatar May 01 '24 01:05 ryzngard

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).

TrieBr avatar May 01 '24 03:05 TrieBr

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

ryzngard avatar May 01 '24 23:05 ryzngard

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.razor__virtual.cs. Detail: Unable to resolve resource virtualCSharp-razor:/Path/ToFile/Component.razor__virtual.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).

TrieBr avatar May 02 '24 01:05 TrieBr