CodexBloom - Programming Q&A Platform

Visual Studio 2022 - implementing Debugging Razor Pages in Blazor Server Application

👀 Views: 185 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-09
blazor razor-pages visual-studio-2022 debugging C#

I'm wondering if anyone has experience with I'm working with a frustrating scenario while trying to debug a Blazor Server application using Razor Pages in Visual Studio 2022. When I set breakpoints in my Razor components, the debugger doesn't seem to hit them at all, even though I'm running the application in Debug mode. I've ensured that the project configuration is set correctly, but the breakpoints still show as 'Not Bound'. I've tried cleaning the solution and rebuilding it, but that hasn't resolved the scenario. Here's a snippet of my `Startup.cs` where I configure services and middleware: ```csharp public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/behavior"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); }); } ``` I've checked the project properties and confirmed that the `Debug` profile is selected, and the debug symbols are being generated. Additionally, I've tried deleting the `.vs` folder and the `bin` and `obj` directories, but that didn't help either. What could be causing the breakpoints not to bind in my Razor components? Is there a specific setting or configuration that I might be missing?