Skip to content

Analyzer doesn't pick up errors in .razor files that have code #1508

@wadebaird

Description

@wadebaird

Bug description

When I have code in a razor file using the "@code {... }" syntax, VSTHRD200 doesn't get raised. I am assuming it might be the same for all VSTHRD* issues.

Repro steps

See the attached solution

Expected behavior

These warnings / errors that appear in CodeBehindRazor.cs should appear for CodeInRazor.razor

Warning (active) VSTHRD200 Use "Async" suffix in names of methods that return an awaitable type (https://microsoft.github.io/vs-threading/analyzers/VSTHRD200.html) BlazorAppVSTHRDRepro BlazorAppVSTHRDRepro\Pages\CodeBehindRazor.razor.cs 5
Warning (active) VSTHRD200 Use "Async" suffix in names of methods that return an awaitable type (https://microsoft.github.io/vs-threading/analyzers/VSTHRD200.html) BlazorAppVSTHRDRepro BlazorAppVSTHRDRepro\Pages\CodeBehindRazor.razor.cs 10

Actual behavior

No warnings / errors in CodeInRazor.razor

  • Version used: 17.14.15
  • Application (if applicable): Visual Studio

Additional context

Add any other context about the problem here.

BlazorAppVSTHRDRepro.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions