简体   繁体   中英

(Potential Visual Studio Bug) Visual Studio 2019 Error List showing errors that should not exist as that error isn't actually present

This is for an ASP.NET Webforms project.

On the .ASPX file there is a :

<span id="FooterTextSpan" runat="server">[Redacted]</span>

I am editing the span from the code-behind (ASPX.cs file), and in Visual Studio, I see this:

当前上下文中不存在名称“FooterTextSpan”

And yet, it is there in the .ASPX file.

In the @Page... declaration the correct CodeBehind is specified, and it Inherits from the correct location, too.

The project does not build if you try to build and don't do the 'hacky-fix' below:

To fix this, you can go into the .ASPX page, and add a space, then delete the space, and the error just vanishes.

How do I resolve this so I do not need to do this 'hacky-fix', as it is happening in other files, too.

Sanguine,

I have met this for few times and it is really annoying.,这真的很烦人。 Fortunately, it is rare.

If you have tried
1) clean and rebuild the solution or
2) delete the .vs folder to clean the cache
and the problem is still there, here is a workaround.

As you can see in VS, there are few of options for selection in the "Error list" section. BuildOptionWithoutIntelliSense

You can select "Build Only" so that the error list only shows the error from build.

Hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM