Skip to content

Critical Bug: Blazor Server @onclick events do not fire on new projects with recent .NET 8 SDKs. #63205

@ramoscovarrubiascr

Description

@ramoscovarrubiascr

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Affected Versions:

.NET SDK Version: [Rellena aquí la versión, ej: 8.0.403 y superiores]

Visual Studio Version: [Rellena aquí la versión, ej: 17.14.11 y superiores]

Operating System: Windows 10/11 , Windows Server Essentials

Description:

There appears to be a critical regression bug in recent versions of the .NET 8 SDK that prevents basic event handling, such as @OnClick, from functioning in Blazor Server applications. The issue is present even in a brand new, unmodified project created from the standard "Blazor Server App" template.

The problem was tested exhaustively:

The issue occurs on multiple, clean machines with fresh installations of Visual Studio and the .NET SDK.

The issue persists when the application is published as a self-contained executable and run outside of the Visual Studio debugger.

The issue is not present when using the Blazor WebAssembly render mode, which confirms the bug is specific to the Blazor Server-side runtime and its SignalR event handling mechanism.

This appears to be a showstopper bug that makes Blazor Server unusable for new projects with the affected SDK versions.

Steps to Reproduce:

On a clean machine, install the latest version of Visual Studio 2022 with the "ASP.NET and web development" workload.

Create a new project using the "Blazor Server App" template, targeting .NET 8.

Open the Components/Pages/Home.razor file.

Replace all the content in the file with the following minimal code for a counter component:
Razor CSHTML

@page "/"
<PageTitle>Button Test</PageTitle>

<h1>Basic Event Test</h1>

<p>
    Current count: <strong>@currentCount</strong>
</p>

<button class="btn btn-primary" @onclick="IncrementCount">
    Click me
</button>

@code {
    private int currentCount = 0;

    private void IncrementCount()
    {
        currentCount++;
    }
}

Run the application (F5).

Expected Behavior:
When the "Click me" button is pressed, the @OnClick event should fire the IncrementCount method, and the number on the screen should increase by 1 with each click.

Actual Behavior:
When the "Click me" button is pressed, the button receives focus (it gets a blue outline in the browser), but the IncrementCount method is never executed. The counter remains at 0. No errors are thrown in the browser console or in the debug output. The event handling appears to be completely non-functional.

Expected Behavior

This bug is a critical showstopper. Basic event handling is the foundation of any interactive application. Until this is resolved, all of our professional development on the Blazor Server platform is completely blocked.

Steps To Reproduce

This bug is a critical showstopper. Basic event handling is the foundation of any interactive application. Until this is resolved, all of our professional development on the Blazor Server platform is completely blocked.

Exceptions (if any)

No response

.NET Version

.NET 9 SDK (Preview): 9.0.304,.NET 8 SDK (LTS, Stable): 8.0.119

Anything else?

The bug is present across multiple .NET SDK versions. We have confirmed the issue on the following installations, on clean machines:

.NET 9 SDK (Preview): 9.0.304

.NET 8 SDK (LTS, Stable): 8.0.119

Downgrading the SDK does not fix the issue, which indicates a critical regression affecting both the latest preview and the current stable Long-Term Support channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions