Aspnetcore: Missing references in Blazor components latest 16.4.0

Created on 10 Dec 2019  路  19Comments  路  Source: dotnet/aspnetcore

_This issue has been moved from a ticket on Developer Community._


[regression] [worked-in:Latest stable release before 16.4.0]
After upgrading to latest 16.4.0 some Blazor components ar marked as missing. The project still compiles fine, so it seems to be a VisualStudio issue.
Also, the issue dissapears if I open the blazor component .razor file to edit... it seems that when its opened the references appears again.

I attach 2 screenshots showing how when I open the blazor component files, the references appear, and they're missing when the files are not being edited.


Original Comments

Visual Studio Feedback System on 12/3/2019, 11:57 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

charlesdeluxe on 12/7/2019, 02:51 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Author Done area-blazor investigate

Most helpful comment

108704-issue (2)

This .gif shows how components are recognized or not depending on when the component is open for edit.
When I close the components edit windows, the references start to dissapear. Even the namespace is not recognized.

Regards!

All 19 comments

Thanks for contacting us.
@NTaylorMullen do you know what could have caused this? Do we need a repro project to investigate this?

I also have the same problem. Project compiles and runs ok. Just the red squiggles. Visual Studio 16.4.1, .NET Core 3.1. Components are local in the same folder.

image

image

@NTaylorMullen do you know what could have caused this? Do we need a repro project to investigate this?

A repro project wouldn't help much with this.

@VaclavElias what's the output of your dotnet --info?

.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100\

Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db

.NET Core SDKs installed:
1.1.13 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.604 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]
2.2.203 [C:\Program Files\dotnet\sdk]
2.2.204 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [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 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [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.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [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 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Hmm @VaclavElias that's what i'd expect. If you're up for a nuclear option to verify something would you mind trying uninstalling Visual Studio and then re-installing it?

I won't be able to do this at the moment because of my time restriction but if I save some time I might try it on another 2 computers where I also run Visual Studio.

I'm the one who reported this in VS Feedback.
I uninstalled/installed VS several times, in my personal computer & my work computer, with different combinations of 3.0.0 and 3.1.0 without success. I also tried deleting manually the sdk & runtime folders. Resetting VS settings to default.

C:Users\Chr>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100\

Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db

.NET Core SDKs installed:
3.1.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

108704-issue (2)

This .gif shows how components are recognized or not depending on when the component is open for edit.
When I close the components edit windows, the references start to dissapear. Even the namespace is not recognized.

Regards!

So odd. I can't reproduce this at all.

  • Do you see the same behavior with the default Blazor template? Aka if you create a new project, open up Index.razor and try using the Counter component does it work as you'd expect?
  • What workloads do you have checked in your Visual Studio installation?
  • Do you happen to have any notable VS extensions installed?

@NTaylorMullen
No, I don't see the same behavior in the default template, it seems that at some point, while the folder structure grows, it starts happening.... I couldn't pinpoint why, I even started removing folders one by one in my project until it works ok, but couldn't find out why.
I can send you a VS project where it happens, do you have an email so I can send it to you?

Regards

No, I don't see the same behavior in the default template, it seems that at some point, while the folder structure grows, it starts happening.... I couldn't pinpoint why, I even started removing folders one by one in my project until it works ok, but couldn't find out why.

Ah, definitely interesting.

I can send you a VS project where it happens, do you have an email so I can send it to you?

Hmm to not paste my email over the interwebs would it be possible for you to create a private GitHub repo (free now) and give me access that way? I can also send you the email address privately via twitter if that works too. Thanks again for the flexibility here 馃槃

@NTaylorMullen I tried to contact you at twitter but there's no answer, I prefer to just send you a .zip file if possible!

@NTaylorMullen I tried to contact you at twitter but there's no answer, I prefer to just send you a .zip file if possible!

Just responded, looks like Twitter was bad and didn't notify me of your tweet 馃槃

Having the same issue here - did this get solved? :)

I also get this issues, if I open the code window for the component the squiggles go away, but reappear when I close the component code window.

trying to add a using statement to the .razor code using my component, won't even list the folder my component is in until I open the component code window.
and also has the same issue in code for the page.
VsError

I got (somewhat) the same problem as well. References to Blazor components are really buggy. It just worked a few min ago, then it was gone.

In Visual Studio 2019 v16.5.1:

I have a component in a folder Components, specifying @namespace RandomEnglishExercises.Components at the top:
image

When I use the component, the IDE seems to notice the existence of the component. However, when I build, it fails.
image

On other tests, without @namespace ..., still cannot work.
Using the component's full name does not work as well.

image

My SDK version is 3.1.3.

It seems that with the latest VS 16.6.0, this issue has been corrected.
Has anyone else had this experience too?

@NTaylorMullen should this be closed now?

Yup, this should be fully fixed in the upcoming 16.7-Preview3 Visual Studio release.

Was this page helpful?
0 / 5 - 0 ratings