Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
387 views
in Technique[技术] by (71.8m points)

Blazor and Visual Studio's Intellisense - some Blazor component references show as false errors until you click on the file

When I open my Blazor solution in Visual Studio, Intellisense will show false errors for references to Blazor components, and will successfully compile.

For example, in many of my classes I inject ILogger<BlazorComponent> that takes a component to log about, in this case, my Details.razor component:

public partial class DetailsBase : ComponentBase
{
   [Inject]
   protected ILogger<Details> Logger { get; set; }
   
   // etc etc... 
}

However, Intellisense always shows a not found error for Details. It will compile successfully but the false error will remain, until you navigate to that particular file - Details.razor in this case - and Intellisense picks it up.

These false errors clutter up my debug window and I'd like to stop them without constantly having to click to go to the file to get it recognised by Intellisense.

Is there some kind of setting I can enable that makes sure Intellisense checks these files? or anything that plays nicer with Blazor than Intellisense?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try disabling the experimental razor editor. It did similar weird things on my end


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...