Open ghost opened 3 years ago
Same error. Is there any other workaround besides switching to VS?
same here. _Imports.razor: error finding .Shared folder; App.razor: Router component can't be found;
Code template generated by dotnet new command
Compiling without a problem.
Hi All, had the same issue. I found a work-around in VS Code by downgrading the C# extension from the current version 1.23.12 to 1.23.11. You can do this in the the extensions panel by clicking on the config button for the C# extension and click 'Install another version', then select the previous version. Version 1.23.12 was released about 12 days ago, and obviously has broken razor intellisense
Hi All, had the same issue. I found a work-around in VS Code by downgrading the C# extension from the current version 1.23.12 to 1.23.11. You can do this in the the extensions panel by clicking on the config button for the C# extension and click 'Install another version', then select the previous version. Version 1.23.12 was released about 12 days ago, and obviously has broken razor intellisense
1.23.9 worked for me! Thank you!
Hi All, had the same issue. I found a work-around in VS Code by downgrading the C# extension from the current version 1.23.12 to 1.23.11. You can do this in the the extensions panel by clicking on the config button for the C# extension and click 'Install another version', then select the previous version. Version 1.23.12 was released about 12 days ago, and obviously has broken razor intellisense
Had the same issue, downgraded to 1.23.11 and looks like it is working with the downgrade workaround.
Could you all verify if this is what you're running into: https://github.com/OmniSharp/omnisharp-vscode/issues/4573
Specifically the mentioned NRE in the OmniSharp log:
@NTaylorMullen I attached my OmniSharp log in my issue. It doesn't throw an unhandled exception of any kind, and I'm targeting .NET 5, not 6, so I don't think #4573 relates to this one (this appears to describe the same issue though: dotnet/aspnetcore#33350)
Oddly enough downgrading to 1.23.11 fixed the issue, but then I upgraded back to 1.23.12 and it keeps working. π΅
Having similar issue. New BlazorWasm application has many errors/warnings. Downgrading to 1.23.11 fixes the issue. (reinstalling 1.23.12 just brought the errors back)
1.23.11 works for me also. Hope it get fixed by 1.23.13 release.
It seems the tracking work is here: #33858
This issue seems to be back with the new v2 C# extension. The _Imports.razor file it's complete ignored, then the intellisense go nutz.
The downgrade it's a working around, going back to v1.26.0 solved it for me.
This issue seems to be back with the new v2 C# extension. The _Imports.razor file it's complete ignored, then the intellisense go nutz.
The downgrade it's a working around, going back to v1.26.0 solved it for me.
Same for me.
same issue here. if downgrade is required, C# dev kit extension becomes unusable.
Can reproduce as of the latest prerelease. Also getting 'RenderTreeBuilder' does not contain a definition for 'AddComponentParameter' and no accessible extension method 'AddComponentParameter' accepting a first argument of type 'RenderTreeBuilder' could be found (are you missing a using directive or an assembly reference?)
repeatedly from intellisense.
tagging @davidwengier for a Razor issue
Can reproduce as of the latest prerelease. Also getting
'RenderTreeBuilder' does not contain a definition for 'AddComponentParameter' and no accessible extension method 'AddComponentParameter' accepting a first argument of type 'RenderTreeBuilder' could be found (are you missing a using directive or an assembly reference?)
repeatedly from intellisense.
https://github.com/dotnet/razor/pull/9265 fixes this.
Will see if I can repro the other issues, but would appreciate any Razor Log output from anyone reproing this issue in the latest C# extension version.
@davidwengier Thanks for looking into this. Here is the Razor Log from my project, where IntelliSense works fine in Visual Studio, but not in VS Code (Preview).
razor-logs-from-my-project.txt - standard logs
razor-logs-verbose.txt - razor.trace
set to Verbose
Most of the log entries mention that there's no project context
. Can I select a project in VS Code in some way?
Solution structure (stripped out all unnecessary context)
.
βββ WebIndemnizacionesVM.sln
βββ Compartido (ClassLib)
βββ DAS (ClassLib)
βββ WebIndemnizacionesVM (Blazor Server)
βββ App.razor
βββ Program.cs
βββ Shared
βββ WebIndemnizacionesVM.csproj
βββ _Imports.razor
βββ appsettings.Development.json
βββ appsettings.json
βββ Shared
βββ MainLayout.razor
βββ Componentes
βββ NavMenu.razor
βββ SideBar.razor
_Imports.cs
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
@using Microsoft.JSInterop
@using WebIndemnizacionesVM
@using WebIndemnizacionesVM.Shared
@using WebIndemnizacionesVM.Shared.Componentes
@using WebIndemnizacionesVM.Data
@using WebIndemnizacionesVM.Data.Microservicios
@using Compartido.DTO.Microservicios.Login
@using System.ComponentModel.DataAnnotations
@using Blazored.Toast
@using Blazored.Toast.Services
@using Blazored.Modal
@using Blazored.Modal.Services
@using MudBlazor
@using CurrieTechnologies.Razor.SweetAlert2
@using Compartido.Utils
MainLayout.razor
using these versions
Razor-logs.log Razor-logs-verbose.log
and using these versions
also... Why component syntax color are red in pre-release version?
UPDATE: added verbose logs
@blackshot To set verbosity, open File -> Preferences -> Settings and search for razor.trace
Thanks, i updated the comment with the verbose logs
Thanks for the logs @blackshot
The good news is that the red component tags are fixed by https://github.com/dotnet/vscode-csharp/pull/6304, so should be in a release soon.
The bad news is there is nothing in the logs that indicates any problem with Razor tooling, which means the NavMenu not being discovered is caused by something else. The _Imports.razor
file seems to be being processed properly, because things like PageTitle
are discovered fine, but for whatever reason when we ask Roslyn for the list of components that are available, NavMenu must not be in the list. You could try attaching the project.razor.vscode.json
file, from the obj
directory, but I suspect that will just show that the NavMenu component isn't in the list.
Is there anything "interesting" about NavMenu? An @inherits
or @namespace
directive perhaps? If you open NavMenu.razor in VS Code are there any errors reported in it? Also, in the file layout you included it looks like maybe the "Componentes" folder starts with a space? Or is that just a typo?
@PeterDraex thank you also for the logs. Other than a couple of requests at the start where folding range requests failed (thats trying to get the areas that can be collapsed with the little arrows in the editor margin) everything looks fine, but perhaps there are requests that are supposed to be there that never happened. When you say "IntelliSense", what exactly do you mean? Do you mean the light bulb suggestions, or the completion suggestions as you type? The logs you attached don't seem to have any typing in them, but I can see a few light bulb requests. Unfortunately nothing that indicates a problem, though to be fair we also don't log if we're returning 0 or 100 lightbulb actions. If the issue is with lightbulbs no showing, which one(s) were you expecting? Unfortunately for various technical reasons VS and VS Code are not quite at parity with which Razor lightbulbs they support, specifically the "Add using" can't be offered in VS Code.
The "no project context" thing can be ignored, VS Code doesn't support that (yet!), and it doesn't indicate a problem. Just means there wasn't a project context sent with the request, so we'd operate on the default context. Totally expected in VS Code.
@davidwengier Oh, I tried to make the logs cleaner (by restarting VS Code, and sending only the beginning) and it looks like the important parts got left out. I'll describe the issue and send new logs now.
My file Purchase.razor
begins like this:
@page "/inventory/purchase"
@using System.Collections.Immutable
@using Microsoft.AspNetCore.Components.Web
@code {
SupplierInInventoryPurchase[] suppliers = Array.Empty<SupplierInInventoryPurchase>();
Layout.ContentTemplate.BreadcrumbItem[] breadcrumbs = new Layout.ContentTemplate.BreadcrumbItem[]
{
new Layout.ContentTemplate.BreadcrumbItem("Inventory"),
new Layout.ContentTemplate.BreadcrumbItem("Purchase", "/inventory/purchase"),
};
VS Code is reporting a problem:
The type or namespace name 'ContentTemplate' does not exist in the namespace 'Layout' (are you missing an assembly reference?)RoslynCS0234
When I locate my cursor after Layout.ContentTemplate.
and press CTRL+Space, it shows general keyword suggestions, not relevant in the context. When I click on BreadcrumbItem
or Layout
and press F12, I get a message that no definition is found.
Here's a new log file, while the error was displayed, I tried bringing up the suggestions and going to definition. Is it helpful?
Thanks for that info, thats very helpful. Unfortunately I'm not sure how helpful I can be. I can think of two possibilities:
Given that your "type or namespace not found" error comes from a C# block, not a component, the most likely explanation is there are multiple things called "Layout" in scope, and Roslyn is binding to one you don't expect. eg, there is a Layout.razor
in your client project, which would mean a type called "Layout", as well as the folder called "Layout" in AdminClient, which would create a namespace called "Layout". Is client referenced from AdminClient? And more importantly, is the "Client.Layouts" namespace included in the _Imports.razor
in AdminClient?
For some reason ContentTemplate.razor
is not being discovered or compiled properly by Razor. I can see it in the logs, so it appears to be in the project correctly etc. Similar to the questions above, does it have errors in it if you open it? Anything in it that would affect compilation, like a @namespace
or @inherits
directive?
Unfortunately without access to the code it will be hard to diagnose this one with just the logs. Don't suppose its open source? :)
One other option is to use the "Razor: Show Razor CSharp" function in VS Code when you have Purchase.razor
open. That will show you the compiled C#, and you'll be able to see all of the using statements etc. that are in scope, which might help narrow it down. You could even try copying the code out of that window, and putting it in a new .cs file in the project, and maybe Roslyn will even highlight which parts are ambiguous, or not found. Potentially doing that with ContentTemplate.razor
might be illustrative too, perhaps checking that the namespace declared in it is the one you expect.
To be very clear here, I'm not saying this isn't a Razor bug, or that it's your codes fault, just that it seems to be something to do with the compiled files, and the compiler doesn't have any logs we can access. The project state seems to be correct from the logs, though if the namespace in the generated files are wrong, then clearly that's not the case.
Thanks for the logs @blackshot
The good news is that the red component tags are fixed by #6304, so should be in a release soon. The bad news is there is nothing in the logs that indicates any problem with Razor tooling, which means the NavMenu not being discovered is caused by something else. The
_Imports.razor
file seems to be being processed properly, because things likePageTitle
are discovered fine, but for whatever reason when we ask Roslyn for the list of components that are available, NavMenu must not be in the list. You could try attaching theproject.razor.vscode.json
file, from theobj
directory, but I suspect that will just show that the NavMenu component isn't in the list.Is there anything "interesting" about NavMenu? An
@inherits
or@namespace
directive perhaps? If you open NavMenu.razor in VS Code are there any errors reported in it? Also, in the file layout you included it looks like maybe the "Componentes" folder starts with a space? Or is that just a typo?@PeterDraex thank you also for the logs. Other than a couple of requests at the start where folding range requests failed (thats trying to get the areas that can be collapsed with the little arrows in the editor margin) everything looks fine, but perhaps there are requests that are supposed to be there that never happened. When you say "IntelliSense", what exactly do you mean? Do you mean the light bulb suggestions, or the completion suggestions as you type? The logs you attached don't seem to have any typing in them, but I can see a few light bulb requests. Unfortunately nothing that indicates a problem, though to be fair we also don't log if we're returning 0 or 100 lightbulb actions. If the issue is with lightbulbs no showing, which one(s) were you expecting? Unfortunately for various technical reasons VS and VS Code are not quite at parity with which Razor lightbulbs they support, specifically the "Add using" can't be offered in VS Code.
The "no project context" thing can be ignored, VS Code doesn't support that (yet!), and it doesn't indicate a problem. Just means there wasn't a project context sent with the request, so we'd operate on the default context. Totally expected in VS Code.
(adding some components to the context in order to understand NavMenu.razor)
.
βββ WebIndemnizacionesVM.sln
βββ Compartido (ClassLib)
βββ DAS (ClassLib)
βββ WebIndemnizacionesVM (Blazor Server)
βββ App.razor
βββ Program.cs
βββ Shared
βββ WebIndemnizacionesVM.csproj
βββ _Imports.razor
βββ appsettings.Development.json
βββ appsettings.json
βββ Shared
βββ MainLayout.razor
βββ LoginCascading.razor
βββ Protegido.razor (used by NavMenu.razor [should be imported globally])
βββ Componentes
βββ Badge.razor
βββ Carta.razor
βββ CartaMaterial.razor
βββ CrearCuentaBancariaModal.razor
βββ NavMenu.razor
βββ SeleccionOrdenModal.razor
βββ SideBar.razor
βββ SpinnerHDI.razor
βββ VerAnotacionesModal.razor
βββ SideBarComps (used namespace by NavMenu.razor imported inside it)
βββ NavItem.razor (used by NavMenu.razor)
βββ NavItemDropdown.razor (used by NavMenu.razor)
I think there is nothing special in NavBar.razor, but razor couldn't find "WebIndemnizacionesVM.Shared.Componentes.SideBarComps" namespace when i opened the NavBar.razor file.
Couldn't find "Protegido" neither which is imported in _Imports.razor
NavBar.razor
@using Compartido.DTO.Microservicios.PermisosWebIndemnizacionVM;
@using WebIndemnizacionesVM.Shared.Componentes.SideBarComps
@inject NavigationManager NM;
@inject SessionService ss;
@code{
[CascadingParameter]
RespuestaLogin? login { get; set; }
[CascadingParameter]
Permisos? permisos { get; set; }
}
<nav class="navbar fixed-top navbar-expand-lg bg-white shadow-sm px-3" style="z-index: 10;">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<img src="@NM.ToAbsoluteUri("img/hdi_seguros_logo2018_rgb-80px.png")" class="logo" alt="">
</a>
<button class="navbar-toggler button-small hdi-btn-tertiary" type="button" data-bs-toggle="collapse" data-bs-target="#menuMobile" aria-controls="menuMobile" aria-expanded="false" aria-label="Toggle navigation">
<i class="fa fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="menuMobile">
<ul class="nav navbar-nav mt-4 d-lg-none">
@if (permisos is null)
{
<SpinnerHDI />
}
else
{
<Protegido Permiso="BAND-GEST">
<NavItem Icono="fa fa-check" Texto="Casos gestionados" Url="" />
</Protegido>
<Protegido Permiso="SEC-PT">
<NavItemDropdown Icono="fa-solid fa-car-burst" Texto="PΓ©rdidas Totales">
<Protegido Permiso="BAND-PEND">
<NavItem Icono="fa fa-edit" Texto="Casos pendientes" Url="perdidas-totales/" Match="NavLinkMatch.All" />
</Protegido>
</NavItemDropdown>
</Protegido>
<Protegido Permiso="SEC-PP">
<NavItemDropdown Icono="fas fa-building" Texto="PΓ©rdidas Parciales">
<Protegido Permiso="BAND-PEND-PP">
<NavItem Icono="fa fa-check" Url="perdidas-parciales/" Texto="Casos pendientes" Match="NavLinkMatch.All" />
</Protegido>
</NavItemDropdown>
</Protegido>
<Protegido Permiso="BAND-AUTH">
<NavItem Icono="fa fa-lock" Texto="Pendientes autorizaciΓ³n" Url="bandeja-autorizacion" />
</Protegido>
<Protegido Permiso="BAND-BLOQ">
<NavItem Icono="fa fa-ban" Texto="Casos bloqueados" Url="bandeja-bloqueados" />
</Protegido>
}
@*<NavItemDropdown Icono="fa-solid fa-car-burst" Texto="Submenu links" >
<NavItem Url="subitems/uno" Texto="Sub item 1" />
<NavItem Url="subitems/dos" Texto="Sub item 2" />
</NavItemDropdown>
<NavItem Icono="fa-solid fa-house-crack" Texto="RecepciΓ³n de vehΓculos" Url="recepcion-vehiculo" />
<NavItem Icono="fa-solid fa-circle-dollar-to-slot" Texto="Pagos disponibles" Url="pagos-disponibles" />*@
@*<NavItem Icono="fa fa-user" Texto="Mi perfil" Url="mi-perfil" />*@
<NavItem Icono="fa fa-lock" Texto="Cerrar sesiΓ³n" Url="#" @onclick=@ss.CerrarSesion/>
</ul>
</div>
<form class="d-flex align-items-center hidden-xs hidden-sm" role="search">
@*<div class="hdi-form-small m-0 mr-3">
<input type="text" class="hdi-form-small-input m-0" placeholder="Buscar">
<i class="fa fa-search hdi-form-small-input-icon"></i>
</div>*@
@if (login is not null)
{
<div class="dropdown">
<button class="button-small hdi-btn-primary" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-regular fa-user"></i> Bienvenido @login?.Usuario.Nombre <i class="fa fa-chevron-down"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
@*<li><a class="dropdown-item" href="@NM.ToAbsoluteUri("mi-perfil")"><i class="fa-regular fa-user mr-1"></i> Mi Perfil</a></li>*@
<li><a class="dropdown-item" href="#" @onclick=@ss.CerrarSesion><i class="fa fa-lock mr-1"></i> Cerrar sesiΓ³n</a></li>
</ul>
</div>
}
</form>
</div>
</nav>
check this out, while i was writting this, i just restarted vscode with NavBar.razor file opened in order to generate a clean log with the error. and this happened...
It loaded well WebIndemnizacionesVM.Shared.Componentes.SideBarComps namespace and its containing components that couldn't load the first time.
UPDATE:
i restarted it again doing nothing more than pressing the close button of vscode and reopened it aaaaand...
first imported just fine SideBarComps (thats why NavItem is green) then without doing nothing (just stared at it) lost its references.
here is the log Razor-logs-verbose-lost-references.log
Indeed, its odd that you would get a green tag with a "could not find component" warning, as both come from data the compiler provides us. What might have happened is that after the project first loaded, and everything was fine, something updated the project.razor.vscode.json file and left out those components for some reason, but VS Code doesn't refresh colors very often.
FYI @phil-allen-msft since I'm OOF for a few weeks. Looks like something odd happening with component discovery, potentially inconsistent project loading and Roslyn giving us mixed info for the project.razor.vscode.json file, or possibly an issue with different events fighting over writing that file. Seems like its inconsistent and will probably be hard to repro unfortunately. A slightly more complication project that normal might help
Also, in the file layout you included it looks like maybe the "Componentes" folder starts with a space? Or is that just a typo?
it was a typo writting here in github, foldername is fine
just in case is helpful, here are my enabled extensions at the moment bug happened.
$ code --list-extensions --show-versions | % { "code --install-extension $_" }
code --install-extension csstools.postcss@1.0.9
code --install-extension Darfka.vbscript@1.0.4
code --install-extension denoland.vscode-deno@3.22.0
code --install-extension eamodio.gitlens@14.3.0
code --install-extension EditorConfig.EditorConfig@0.16.4
code --install-extension file-icons.file-icons@1.1.0
code --install-extension fireside21.cshtml@0.1.3
code --install-extension george-alisson.html-preview-vscode@0.2.5
code --install-extension GitHub.copilot@1.111.404
code --install-extension letmaik.git-tree-compare@1.16.0
code --install-extension mechatroner.rainbow-csv@3.7.1
code --install-extension Meezilla.json@0.1.2
code --install-extension mhutchie.git-graph@1.30.0
code --install-extension ms-azuretools.vscode-docker@1.26.0
code --install-extension ms-dotnettools.csdevkit@0.4.10
code --install-extension ms-dotnettools.csharp@2.1.2
code --install-extension ms-dotnettools.vscode-dotnet-runtime@1.7.3
code --install-extension ms-dotnettools.vscodeintellicode-csharp@0.1.26
code --install-extension ms-vscode-remote.remote-containers@0.309.0
code --install-extension ms-vscode-remote.remote-ssh@0.106.4
code --install-extension ms-vscode-remote.remote-ssh-edit@0.86.0
code --install-extension ms-vscode-remote.remote-wsl@0.81.3
code --install-extension ms-vscode.powershell@2023.6.0
code --install-extension ms-vscode.remote-explorer@0.4.1
code --install-extension Oracle.oracledevtools@21.6.0
code --install-extension redhat.java@1.22.1
code --install-extension redhat.vscode-xml@0.26.1
code --install-extension redhat.vscode-yaml@1.14.0
code --install-extension shakram02.bash-beautify@0.1.1
code --install-extension SonarSource.sonarlint-vscode@3.21.0
code --install-extension VinceSalvino.dark-plus-black@1.2.0
code --install-extension VisualStudioExptTeam.intellicode-api-usage-examples@0.2.8
code --install-extension VisualStudioExptTeam.vscodeintellicode@1.2.30
code --install-extension vscjava.vscode-gradle@3.12.7
code --install-extension vscjava.vscode-java-debug@0.54.0
code --install-extension vscjava.vscode-java-dependency@0.23.1
code --install-extension vscjava.vscode-java-pack@0.25.14
code --install-extension vscjava.vscode-java-test@0.39.1
code --install-extension vscjava.vscode-maven@0.42.0
After update to a new version of VS Code Insiders, I am seeing an System.InvalidOperationException
in C# Output window, coming from LanguageServerHost.
@blackshot, @PeterDraex no resolution on this?
@davidwengier I'm facing the same issue right now and my project is open. I've created a snapshot branch here.
It's working like a charm in VS, hit this issue as I'm trying out VS Code as alternative:
EventComponent.razor
will do. Symptoms seem consistent with what's described here. Specifically:
If you need something else to debug this, please share.
@achobanov I'm still experiencing the issue as well
@achobanov do you have a project.razor.vscode.bin
folder in obj\Debug\<tfm>
? If so, how big is it?
When I cloned your repo locally, I couldn't get anything restoring or building, but I suspect that is due to missing .NET SDKs. Your global.json targets 5.0
(which VS Code seems to tell me is invalid π€·ββοΈ) so thats not very surprising, as my machine is definitely not "clean" when it comes to the various builds I have installed. I also got errors about targeting net6.0-androind
which is apparently out of support. If I remove the global.json then things restore properly, but components are still not discovered in the EMS.Judge.UI
project. I can tell this because the project.razor.vscode.vin
file is about 2KB. Upgrading things to .NET 8 (literally just replacing the "7" with an "8" in the EMS.Judge.UI.csproj
and the "6" with an "8" in the EMS.Witness.csproj
to get rid of the android warnings, I then got a project.razor.vscode.bin
file of 800+KB and everything seemed to work fine when opening the EventComponent.razor
file. No errors, all components were green etc.
Unfortunately we don't have a good story for logging anything when the project.razor.vscode.bin
file is missing information. Generally speaking it means the Roslyn project can't see the types/components in question, or maybe Roslyn can but the compiler rejected the compilation for some other reason. Another thing to check that might indicate what is happening is to run the "Show Razor CSharp" command in VS Code and check that the namespace of the generated file is correct:
If project information isn't available to Razor this will be "ASP" or even "__GeneratedComponent"
@blackshot, @PeterDraex no resolution on this?
@davidwengier I'm facing the same issue right now and my project is open. I've created a snapshot branch here.
It's working like a charm in VS, hit this issue as I'm trying out VS Code as alternative:
- Clone a fresh repo
- Restore MAUI workloads
- Rebuild the solution, first time it takes a while
- Open a file -
EventComponent.razor
will do.Symptoms seem consistent with what's described here. Specifically:
- _Imports.razor usings aren't resolved
- Inline components (no code behind class) don't seem to be registered as namespaces by the compiler.
- Custom components are not resolved (RZ10012) - this is true even if I add the relevant using in the same file.
If you need something else to debug this, please share.
I'm also experiencing the same issue but I found a workaround and hope it helps troubleshoot the issue. Just like others have said I'm also having issues with some components not being picked up by vscode (RZ10012) and I noticed that some work ok, while others don't. After some experimentation, I noticed that the components that were being picked-up correctly were using a .cs partial class and they explicitly inherited from ComponentBase in the c# partial class cs file. I started refactoring all components to have a cs file with a partial class, even those without any code block, and one by one they started working as soon as I added the ComponentBase inheritance in the c# partial class. This is far from a solution because while CS code behind files is great for complex components its not ideal for very simple components or components that don't even require a "@code" block. Hope this helps you get to the bug and find a solution.
Also, before finding this workaround I noticed that components that were not being picked-up started to do so after opening the component file in vscode.
Have the same issue when I reference any of my components. However, when I open the referenced component in VSCode, the "Razor(RZ10012)" warning disappears.
I do not have the issue when I am creating a new dotnet new project on the same computer. I tried "dotnet clean" on the existing project but it changed nothing. Using .NET 8
as target platform for the existing and new projects.
I also tried creating a new project with over 500 small components and get the same behaviour for a few seconds, but then it seems to resolve itself somehow. I struggling to find why this is not happening on the existing project. My only guess currently is that it is the size of the project...
When using OmniSharp the "Razor(RZ10012)" is NOT appearing, it is only when I am using C# Dev Kit
Getting the same error Razor(RZ10012) for common blazor components. Intellisense is basically broken. Downgrading C# extension solve the error, but then, I cannot build or debug to my android device
I can confirm that this is not working. I am using latest C# Dev Kit (1.8.8) and in a freshly created project via
dotnet new blazorwasm
the namespace of the project and the App component is marked as unknown as shown in this screenshot:
I have tracked down the C# extension versions:
I have tracked down the C# extension versions:
- 2.30.28 works
- 2.31.16 does not work
Solves partially. Sometimes doesn't recognize components until the .razor file of the component is opened
Working for me on version v2.34.12 Tested with pre-release and got the issue back
There's a big issue with the latest versions (after 2.32.14) where the dev console is filled up with errors, that also manifest with incorrect Razor errors showing. It was transferred to the Razor repo. Hopefully will get fixed.
I noticed in the changelog for 2.33.17 (where the problem first occurs) that Razor was updated to prerelease of v9: Bump Razor to 9.0.0-preview.24281.3
Issue Description
Steps to Reproduce
dotnet new blazorserver -o test
)Shared/MainLayout.razor
) and the_Imports.razor
file(Note that this does not happen in Visual Studio 2019)
Expected Behavior
This extension doesn't show any errors for the generated code
Actual Behavior
All components used in Blazor html markup and in C#
@code
sections (not present in the generated code) are highlighted in blue or red (info/error) because the extension fails to identify and resolve correct@using
directives in the top-level_Imports.razor
fileUpdate
I have disabled all extensions except for the OmniSharp C# one and it is still reporting every single component usage as an error.
Logs
OmniSharp log
OmniSharp log
C# log
C# log
Environment information
VSCode version: 1.56.2 C# Extension: 1.23.12
Dotnet Information
.NET SDK: Version: 5.0.202 Commit: db7cc87d51 Runtime: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.202\ Host (useful for support): Version: 5.0.5 Commit: 2f740adc14 .NET SDKs installed: 3.1.408 [C:\Program Files\dotnet\sdk] 5.0.202 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |aspnetcorerazor-html-css-class-completion|kevin-chatham|1.0.3| |auto-close-tag|formulahendry|0.5.10| |auto-complete-tag|formulahendry|0.1.0| |auto-rename-tag|formulahendry|0.1.6| |auto-using|Fudge|0.7.15| |autoimport|steoates|1.5.4| |blazorwasm-companion|ms-dotnettools|1.1.0| |bracket-pair-colorizer-2|CoenraadS|0.2.0| |browserslist|webben|1.1.0| |code-spell-checker|streetsidesoftware|1.10.2| |codespaces|GitHub|0.10.4| |comment-ts|salbert|1.0.21| |csharp|ms-dotnettools|1.23.12| |csharp-colors|logerfo|0.1.8| |cshtml|fireside21|0.1.3| |debugger-for-chrome|msjsdiag|4.12.12| |docfx-assistant|tintoy|0.1.5| |docomment|k--kato|0.1.20| |dotenv|mikestead|1.0.1| |easyzoom|NabeelValley|0.1.0| |EditorConfig|EditorConfig|0.16.4| |fluent-icons|miguelsolorio|0.0.11| |format-selection-as-html|adrianwilczynski|2.3.0| |git-graph|mhutchie|1.30.0| |github-markdown-preview|bierner|0.0.2| |github-vscode-theme|GitHub|4.1.1| |gitignore|codezombiech|0.7.0| |gitlens|eamodio|11.4.1| |headwind|heybourn|1.7.0| |html-css-class-completion|Zignd|1.20.0| |html-slim-scss-css-class-completion|gencer|1.7.8| |JSDocTagComplete|HookyQR|0.0.2| |markdown-checkbox|bierner|0.1.3| |markdown-emoji|bierner|0.1.0| |markdown-preview-github-styles|bierner|0.2.0| |markdown-yaml-preamble|bierner|0.0.4| |material-icon-theme|PKief|4.7.0| |material-product-icons|PKief|1.0.4| |material-theme|zhuangtongfa|3.10.14| |npm-intellisense|christian-kohler|1.3.1| |postcss|csstools|1.0.9| |prettier-vscode|esbenp|6.4.0| |quokka-vscode|WallabyJs|1.0.369| |razor-plus|austincummings|0.1.4| |remote-containers|ms-vscode-remote|0.177.2| |remote-wsl|ms-vscode-remote|0.56.3| |svelte-autoimport|pivaszbs|1.0.4| |svelte-extractor|proverbialninja|0.0.3| |svelte-intellisense|ardenivanov|0.7.1| |svelte-vscode|svelte|105.0.0| |tailwind-docs|austenc|1.4.0| |tailwind-sass-syntax|macieklad|1.3.0| |theme-dracula|dracula-theme|2.22.3| |vscode-docker|ms-azuretools|1.13.0| |vscode-dotnet-runtime|ms-dotnettools|1.1.0| |vscode-eslint|dbaeumer|2.1.20| |vscode-firefox-debug|firefox-devtools|2.9.4| |vscode-html-css|ecmel|1.10.2| |vscode-html-scss|P-de-Jong|0.0.42| |vscode-language-babel|mgmcdermott|0.0.31| |vscode-npm-script|eg2|0.3.21| |vscode-pull-request-github|GitHub|0.26.0| |vscode-sqlite|alexcvzz|0.12.0| |vscode-stylelint|stylelint|0.86.0| |vscode-tailwindcss|bradlc|0.6.6| |vscode-versionlens|pflannery|1.0.9| |vscode-yaml|redhat|0.19.2| |vscodeintellicode|VisualStudioExptTeam|1.2.14| |zoombar-vscode|wraith13|1.4.0|;