Closed vsfeedback closed 2 years ago
Thank you for filing this issue. In order for us to investigate this issue, please provide a minimalistic repro project (ideally a GitHub repo) that illustrates the problem.
It looks like you're using older version of VS. Please upgrade to the latest released version (16.4) and it should be fixed there.
this issue happened to me on VS 16.4.2 I fixed it by restarting VS, you may wanna make sure that it's completely fixed...
I can confirm this is occuring on 16.5 preview 1
Issue on vs 16.4.3
If I add a Component.razor via Add>New Item>Razor Component intellisense seems to be OK
If I copy, paste then rename an existing Component.razor to e.g. ComponentX.razor intellisense does not pick up the file rename and instead picks up
However, If I open the new file in the editor it works
Restarting VS also fixes it
Same here with VS 16.5.0 Preview 2.0 After creating the default template project, Intellisense for the components doesn't work. (SurveyPrompt, NavMenu etc.) Restarting VS fixes it. Please re-open this issue.
The problem still exists. This is how you can reproduce: Create a blazor component. Rename it through rename option in solution explorer. The editor cannot find the class and the build does not go ahead.
Reopening as this seems to be impacting many people. @NTaylorMullen can you please look into this? Thanks!
Also This issue exist in VS code
Also This issue exist in VS code
Would you mind doing the "Report a Razor issue"command and pasting the output here (In addition to manually copying the OmniSharp Log's?
I had this problem with 16.4.6. Realizing this is in the preview I installed the preview version of VS (16.5.0 Preview 5.0) and at first glance, it seems to be working. I have not done much with it yet but at least I am not getting the red underlines and warning on valid code/markup.
I have this problem too. Sometimes only one or two errors, but today there are 117 prompting me to look for a solution. It still compiles and runs, but when I get a real error, it makes it more difficult to find.
If anyone is able to provide a repro project that will enable us to investigate further.
@NTaylorMullen I checked to see if it was something I was doing by downloading an app that I had seen on Pluralsite that is on github called, "BethanysPieshopHRM" It demonstrates the problem on my machine.
I also dont have a clean install, I have been installing Visual Studio on this computer for about five years and a lot of different versions show up in my programs list.
Also, I had BethanysPieShop open at the same time as my project, but that shouldn't matter.
The problem seems related to the caching of namespaces, and it doesn't always happen. If you don't see the error, open a few .razor pages, or drag and drop a file to a different folder.
Also I have noticed that it "may be" true that if I leave a space after a name, it increases the odds of it happening,
And finally it seems to happen to the most recently created components even when it was otherwise okay.
Oh, and copy-pasting a component seems to increase the changes it will cause this.
Also having an invalid path in the imports file may contribute
So, lots of hints as to possible cause, my money is on the caching of the namespaces or else keyboard shortcuts.
@NTaylorMullen I was able to duplicate this problem by opening BethanysPieShopHRM and then
Also there is another similar problem that i am experiencing today. I was having the above problem on two folders where there was a file by the same name as the folder in each. I renamed the folder and restarted. The Intellisense now shows the old folder name, which it previously said was not there, and was not on intellisense and does not show the new folder name. If a restart doesn't fix it, then I will edit this message.
Edit: A restart did not fix this problem. The intellisense shows five folders out of the seven that are actually there, and it complains if I add them. If I add a new folder instead of renaming, and I then create a new razor file and paste my other code into this, then it will probably fix this. I will edit again if it doesn't. (Even with the bugs I would rather use Blazor than any other development environment.)
Sadly renaming Blazor files/folders does not always yield a great experience today (requires close/re-open of file) and in some cases the older file name will persist along side the newer one. If you want to work around this bug you can delete your bin/obj directories and re-compile.
@NTaylorMullen Thanks you! This fixed the issue. I had a couple of errors that either were being drowned with noise, or else weren't showing at all. For people who have my specific problem, of actual errors being masked, I would call this a fix (so far) as I haven't had this problem again since doing this.
@talldaniel does this fix all of your issues? As in did deleting bin/obj fix the closed/open issues you were seeing?
@NTaylorMullen The short answer is "Yes".
This does not explain why the Pluralsite code also shows the same issue, but perhaps it too has a empty folder or ... Thank you for your help, as it is now even easier to develop in Blazor. Edit: Actually it may not have complained about the empty folder until after I deleted the obj folder but I am sure it did complain about the illegal XAML and I took it to be a false alarm because it was listed along a lot of other ones that looked very similar that were false alarms. Also, it is not bin/obj it is just obj
Just had the problem again. I had a legit error and I fixed it, and then two false errors were being reported having to do with namespaces. (Cannot find ...) I closed all windows, re-opened and that fixed it this time.
I am also having this issue with all 7 components in my Blazor Server Side project. I've tried all of the above fixes (clean & delete obj/bin folders). Problem persists. All dependencies are latest preview versions, as is VS2019.
@stevebond007
Make sure you don't have any empty folders listed in the imports file. Also, close all open windows before deleting the obj folder.
95% of the time there is a actual "error" though I wouldn't think simply having an empty folder referenced should count as an error (for example) but it does.
When it is not an actual error, it should only list a few errors, in my experience, after you have done the clean, restart and the removal of obj folder.
If it is not a legit error, open the file the error message says it cannot find, and click on it. At least once for each time it lists not being able to find it.
When it is an actual error(s) you might see 120 errors, though more like 25 usually. When I saw over 100 errors listed, I actually had 2 or 3.
Also, if you have any .razors that you renamed, then I am not sure if the above advice will help.
My rule of thumb now is to always build before moving to another page, that way I know where the error has to be.
Edit: Here an example. I had 45 errors listed, and it was actually I forgot a semicolon at the end of a line of code. There is almost never that many when there are no real errors.
VSCode 1.43.2 dotnet new blazorserver Open Folder Found markup element with unexpected name 'NavLink'. If this is intended to be a component, add a @using directive for its namespace. Builds and runs. Just a bit annoying.
This just happened to me (VS2019 16.5.4). In my case it was all my .razor layout files Header, Nav, Footer, that I had once copy/pasted/renamed, but that was several reboots ago. The errors went away after restarting VS. Not sure how to repeat this, but IntelliSense is always slow to update and with Blazor, it's frequently giving me false errors that build just fine.
Likely it is easy to repeat, just write a line of code that does not compile correctly and it will all come back, and stay back after you fix he line of code.
Edit: Also, each update the amount of time to wait for (presumably) the Intellisense is increasing. I often will type one letter, wait 15 seconds, type one character, watch the screen freeze, type one character, watch it freeze, and then it will work somewhat normally for a while, but even then I can sometimes type entire lines of code before it shows on the screen. And then once it does unfreeze the screen will be red with errors like "cannot cast type myClass to type myClass. If it gets much worse it will be unusable.
Edit again: VS continues to lock up almost every keystroke, depending on what I am doing, but doing most things will cause it. The long list of errors now take the place of real errors. For example, I accidentally pasted HTML code into a method and though it caused it to not compile, none of the four errors listed were the actual error. This is getting more common where the list of errors is wrong, but the true errors are not even listed. But the worst part is the 15 second delays on every keystroke while doing certain things which is probably related to VS taking 40 percent of the processor resources on my four core machine when I have VS in the background, and even more when I am using it. Final Edit! Fixed it on my computer. Moved all of my components to a newly created project, to be under the Pages folder and simplified the rest of the namespaces and that seems to be the fix. This fixed both the many seconds long repeated delays and the false errors.
I have the error in Version 16.5.3.
Yeah, the problem is back for me too.
I am getting fairly experienced with this bug, as I have about a thousand hours of experience with it now, where EVERY backspace, spacebar, copy paste, build, create new file, anytime I look at the screen and see it full of errors that are not real, or not displaying the errors that are real, or the entire screen appearing like I am in Notepad, etc. And the constant FREEZING!
This is actually with no errors and was the screen I saw as I published to Azure.
@NTaylorMullen This bug seems to have made itself worse. I had seven errors, none of them the one that was real. (same old) But the app wouldn't run. So, I changed to another computer, and still had the error. I rolled back to a known good build, it ran once, but I made a tiny change and it failed to run after that. I undid the change, and it still wont run. So, I have a 36,000 lines project that is dead in the water because it now seems to be treating these fake errors as real errors deleting the obj folder no longer helps. Any suggestions? I am building a new computer tonight, if that helps.
Those errors you linked @talldaniel I believe are fixed in 16.7-preview2 (not yet released)
Do you suppose the delay will be more than a month?
It'll be released to a preview channel before a month but it wont be "official" for some time
Thanks Taylor, Blazor is the best development environment ever and I look forward to when it is stable.
Also, I noticed in the Blazor faq that this is the most common error people are having, and it claims that the problem comes from using the wrong version of Visual studio. I just installed Windows 10 pro and then VS 2019 on a new computer yesterday, and have this problem, so I don't think that is right, unless there is something else I am supposed to do to get the "right" version. I don't think it is caused from using the wrong version of VS, unless there is something I am missing. Edit: Here is the link that says this bug is caused by using the wrong version of VS https://github.com/dotnet/aspnetcore/wiki/Common-Problems-and-Solutions-in-Blazor
Still happening in VS 16.6.0. Generated new project+solution. Seems to error out on components and or templates. Dead in the water here. It wasn't shown in the picture but I'm getting an error: "rzc generate exited with code -2147450730"
I suggest you copy the code in the file that is failing and paste it into notepad and save. Delete the Razor page Do a clean, restart VS and do another clean (You can also delete the obj folder, but it it seems to be a small risk causing other problems with TFS/GIT (not sure)) Create a new Razor file with the same name, but located in the Pages folder. Copy the notepad text and paste that into this file.
Edit: Just saw that it was a new solution. The above may not help.
I am not sure, as I have seen thousands of seemingly bogus errors that could just be ignored, (not all were bogus of course) but for this one, I think I just stopped using Authorized, and instead used AuthorizedView. (Though after I had all the Authorization working correctly, it appeared to work with just Authorized)
eg, <AuthorizeView Roles="admin">
It is the other Authorized you can use if it is for just part of a page but nothing stops you from putting it at the top of a page
Authorized doesn't interact with AuthorizedView as you would think anyway. Better to use the AuthorizedView IMO.
Also it works well with roles
So, this is my suggestion, change it to AuthorizedView and then later, try again if you prefer the Authorized.
Once you get used to it, even with the bugs it is a much better development environment than MVC or WPF, Javascript, etc. Most of the old models such as MVVM or MVC won't let you see the full improvement though. Everything is different now.
I am not a razor expert and I'm simply trying to publish code written by someone else. This code happens to be core. In my case, it runs fine in debug without showing any errors, but publish shows the errors and won't publish. A quick scan of this topic did not show any particular relationship to publishing vs debugging--forgive me if it's there. Is there someplace to vote the severity up or a way to make it publish regardless of the error?
For publishing, the Happy Path is continuous delivery. It is just a wizard and is easy to use, and will likely work for you.
I'm on VS 2019 version 16.7.2 and this is a complete mess. I've literally just added a brand new component to my Components folder, namespaces are all uniform following folder structure, added a page then attempted to add the component as an object in the page's base class. Intellisense auto-completed the namespace and component as I was typing it, then told me that it doesn't exist and won't build.
I've tried closing and re-opening VS, cleared bin and obj folders, no difference at all.
I wouldn't use such a strong language but I absolutely agree with the sentiment: random crashes, lack of any kind of refactoring support, and general unpredictability. There are so many different crashes that I have stopped reporting. VS is probably the best IDE in the market. However, for blazor, is only slightly better than VIM.
Maybe that was a little strong, I've removed the language but it is very irritating. Just a note, the component that I was having a problem referencing I've now moved to a new components project and it is now working. So it was:
The project [MyApplication].Web.App contained a Components folder and all components within that folder were in the namespace [MyApplication].Web.App.Components. These components were referenced by pages within [MyApplication].Web.App.Pages (folder and namespace) and the references were broken.
I created a new project within the solution called [MyApplication].Web.App.Components and moved everything from the Components folder in the Web.App project into the new project, then set the Web.App project to reference the Web.App.Components project, so the components project is forced to build first. The references are now working with no issues.
I still get a load of intellisense errors, mainly in the .razor files, but the solution does actually build and run properly.
Hey folks, just chiming in to say we hear your pain and are working hard to make Blazor's tooling experience excellent. So some high level information on where we're going here: The existing Razor editor, the one that's been there from the beginning and the one that you've all been using, has a lot of power but of course also has a LOT of quirks and inadequacies that hinder our ability to innovate & address issues for all of you folks in a timely manner. So in the background we've been re-thinking how our Blazor editor works from the ground up and actually in 16.7 we exposed a preview feature flag to enable a new experimental Razor editor:
Now hold your breath. It currently has some significant known issues. Issues like incoherent coloring, misaligned errors, crashing when you close a solution or inability to reopen documents without losing C#/HTML IntelliSense BUT it's design is significantly simpler then anything we've had previously and will serve as the foundation for us to innovate and deliver you all a better overarching experience faster!
So all of that said, please hang in there! We're hard at work to make everything better. If you're feeling adventurous try out the new editor and send us feedback. Totally can understand the pain of working in an environment where the editing experience hinders your ability to deliver.
If you're extra curious, tomorrow (8/25/2020), we (the Razor/Blazor tooling team) have a .NET community standup where we'll be sharing a general update on what's been going on and what's planned to happen and when.
I have been using the experimental editor and constantly keeping my version of VS 2019 up-to-date, but now I not only get spurious errors from Intellisense but also from the experimental editor (with purple lines, oddly, though it doesn't bother me) telling me there are markup issues, but not specifying what they are.
I did have a sweet sweet moment this afternoon where all errors disappeared. I don't think I had done anything, but when it happened I have to admit I just sat and looked at it, remembering what error-free code looks like...
The project still builds, runs and works (it's partly running in live production) as mentioned before, but Intellisense and the new editor are having a complete hissy fit.
Is this standup something that's public or is this just for our information to show it's being actively discussed?
Thanks for sharing some good news @NTaylorMullen !!
Is this standup something that's public or is this just for our information to show it's being actively discussed?
Public for all! https://www.youtube.com/watch?v=nci0ZMoGcLM
but Intellisense and the new editor are having a complete hissy fit.
If you're willing to spend some time helping us capture enough logs / investigate we'd love to dive into what's happening on your end. If that's something you're interested in please file a new issue with some of the specific issues you're seeing (can mention me) and we can see what's going on.
If you're willing to spend some time helping us capture enough logs / investigate we'd love to dive into what's happening on your end. If that's something you're interested in please file a new issue with some of the specific issues you're seeing (can mention me) and we can see what's going on.
I'll file a new issue but would prefer not to share too much source code of this project in a public domain, unless I can reproduce this in a test project. The absolute number one problem for me is the number of false negatives. I have a genuine issue somewhere in my code but it's completely swamped by 100+ other "errors" that aren't actually errors and it's virtually impossible to find or diagnose anything.
I did have a sweet sweet moment this afternoon where all errors disappeared. I don't think I had done anything, but when it happened I have to admit I just sat and looked at it, remembering what error-free code looks like...
The project still builds, runs and works (it's partly running in live production) as mentioned before, but Intellisense and the new editor are having a complete hissy fit.
Keep an eye on the lower left corner. Even when it shows it's "ready" don't believe it. Wait till the animation stops and some more. False errors would disappear. Works for me about 90% of time.
I dearly wish it was that simple, but I still get errors even after I've run the program then stopped it again. Errors also linger, I've removed files completely and the errors are still there. I am constantly closing VS, clearing bin and obj, reopening then rebuilding and it is sooooooooo time consuming it's unbearable.
This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:16.3.3] After updating vs 16.3.3 visual studio gives errors on markup. Example "Found markup element with unexpected name "EditForm". If this is intended to be a component, add a using directive for its namespace.
Original Comments
Visual Studio Feedback System on 10/9/2019, 11:31 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.
Visual Studio Feedback System on 10/23/2019, 07:02 PM:
This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.
Georgi Petrov Yaramov on 11/8/2019, 01:58 PM:
Same happened in VS 16.3.8
Melvin C Wiley on 11/23/2019, 02:38 PM:
Same happened in VS 16.3.10
Melvin C Wiley on 11/26/2019, 05:26 AM:
This also happens in VS2019 16.4 Preview 6. This appears to be a problem with intellisense. Is this being looked into? Is there a patch to fix this?
Aaron Mckee on 12/5/2019, 11:37 AM:
Its like using notepad to develop again... please fix!
Original Solutions
Georgi Petrov Yaramov solved on 11/8/2019, 01:59 PM, 0 votes:
Same happened on VS 16.3.8