Skip to content

Incorrect marking of issue CS8981 when using this example in Visual Studio 2026 #36613

@SorenFog

Description

@SorenFog

Description

Hi

For some strange reasons, using the exact code here creates "squiggly" green underlines for a part of the file, 8981 being a warning that names are lowercased but shouldn't be due to potential future name collision.

No matter what I do, remove everything or alter names using capital letters only, even, and the squiggly indicating an error remains. Compiling the file yields zero errors or warning messages, as if the problem wasn't there in the first place. I ignored it and carried on, everything works as it should, except for annoying squiggly warning for an issue that doesn't exists.

Here is the first half of the file with markers [squiggly] and [/squiggly] inserted where the squiggly begins and ends (remove these to see the actual/original code). The span of the error message makes no sense either, starting at the end of line 1 (before the \r\n and continuing to right after the "@" in line 4. Would have left a screenshot for you if the form allowed. Looks to me like a bug in Visual Studio.

@page "/todo"[squiggly]
@rendermode InteractiveServer

<PageTitle>Todo</PageTitle>

<h1>Todo (@[/squiggly]todos.Count(todo => !todo.IsDone))</h1>

<ul>
	@foreach (var todo in todos)
	{
		<li>
			<input type="checkbox" @bind="todo.IsDone" />
			<input @bind="todo.Title" />
		</li>
	}
</ul>

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/tutorials/build-a-blazor-app?view=aspnetcore-10.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/tutorials/build-a-blazor-app.md

Document ID

23f2cad2-31f9-d5d1-671c-5613fb812b19

Platform Id

bd969b29-9f48-c89d-3ae1-024bcd06e1a9

Article author

@guardrex

Metadata

  • ID: 23f2cad2-31f9-d5d1-671c-5613fb812b19
  • PlatformId: bd969b29-9f48-c89d-3ae1-024bcd06e1a9
  • Service: aspnet-core
  • Sub-service: blazor

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions