Describe the bug:
Breakpoint in razor page is not being hit in Blazor WebAssembly project, if the code is separated from razor page
Version used:
Microsoft Visual Studio Enterprise 2022
Version 17.3.3
VisualStudio.17.Release/17.3.3+32825.248
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Enterprise
ASP.NET and Web Tools 17.3.376.3011
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.3.376.3011
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.3.376.3011
Azure Functions and Web Jobs Tools
C# Tools 4.3.0-3.22423.10+b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Markdown Editor v2 2.0.130
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
NuGet Package Manager 6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.
REST API Client Code Generator 1.0
SQL Server Data Tools 17.0.62207.04100
Microsoft SQL Server Data Tools
TypeScript Tools 17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.3.0-3.22423.10+b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
WiX Toolset Visual Studio Extension 1.0.0.18
WiX Toolset Visual Studio Extension version 1.0.0.18
Copyright (c) .NET Foundation and contributors. All rights reserved.
To reproduce:
Create new Blazor WebAssembly project, selected "ASP.NET Core hosted"
Change the code of Pages/Counter.razor to the following
Set a breakpoint on line @if ((currentCount % 2) == 1), as well as currentCount++, and hit F5 to start Debug session.
Both breakpoints will be hit.
Remove section @code{}.
Create a new file: Pages/Counter.razor.cs with following content
namespace BlazorApp1.Client.Pages
{
public partial class Counter
{
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
}
Hit F5 to start debug session, the breakpoint in Pages/Counter.razor will not be hit, while the one in Pages/Counter.razor.cs will still be hit.
Expected behavior:
Both breakpoints in Pages/Counter.razor and Pages/Counter.razor.cs should be hit.
Actual behavior:
The breakpoint in Pages/Counter.razor will not be hit, while the one in Pages/Counter.razor.cs will still be hit.
Additional context:
Add any other context about the problem here.
Describe the bug: Breakpoint in razor page is not being hit in Blazor WebAssembly project, if the code is separated from razor page
Version used:
To reproduce:
Create new Blazor WebAssembly project, selected "ASP.NET Core hosted"
Change the code of
Pages/Counter.razor
to the followingSet a breakpoint on line
@if ((currentCount % 2) == 1)
, as well ascurrentCount++
, and hitF5
to start Debug session.Both breakpoints will be hit.
Remove section
@code{}
.Create a new file:
Pages/Counter.razor.cs
with following contentHit
F5
to start debug session, the breakpoint inPages/Counter.razor
will not be hit, while the one inPages/Counter.razor.cs
will still be hit.Expected behavior: Both breakpoints in
Pages/Counter.razor
andPages/Counter.razor.cs
should be hit.Actual behavior: The breakpoint in
Pages/Counter.razor
will not be hit, while the one inPages/Counter.razor.cs
will still be hit. Additional context: Add any other context about the problem here.