4

I am trying to debug my webassembly blazor client. I was previously using VS2019 fairly successfully, except that the breakpoints were unbound till I toggled them off and on again after starting the debug session.

I tried the VS 2022 preview and found that if I introduced a delay at the start of the app like this:

public class Program
{
    public static async Task Main(string[] args)
    {
#if DEBUG
        Console.WriteLine("Delaying");
        await Task.Delay(5000);
        Console.WriteLine("Delay Done");
#endif
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add<App>("#app");

        builder.Services.AddBlazorise(options =>
... etc.

Then with .NET 5 libs and VS2022(preview) it worked. So I resolved to struggle on till the full releas came out, and now I have upgraded to the release version of 2022 and updated the libs to .NET 6. I am finding the problem is in fact worse. This because I can't get the breakpoints to bind at all any more.

Fortunately, I have not gotten very fara with this and can roll back to Net5 and VS2019 again. However, I was wondering if this is just me, or have I done something stupid.

I have checked that the DEBUG>OPTIONS>GENERAL>'Enable Javascript debugging for ASP.NET is enabled, however, here is agrab of my options in case anyone can see anything I have set wrongly... Debug>General options

Given that this has been going on for some time and I am far from the only person with this issue (though very little about it on here), I wondered if anyone could help as it is really stopping me from getting on atm.. Thanks in advance, Brett

EDIT I am interested in peoples thoughts on this. I took my backup of the project (at .net5) and upgraded it again. Now all seems to be working ok., but I can't help womdering if it isn't something to do with when I tried to restructure my components folder (which contains razor, razor.cs and razor.css files). It caused initial errors because the namespace for the razor files is implied and I needed to change that of the .cs files (I am using partial classes for them). After that, it was just broken. I also tried deleting the .vs file in the root project but that didn't help either. Is there a formal process for moving .razor files around? Curious.

Brett JB
  • 687
  • 7
  • 24
  • I have the same. Breakpoints in my Blazor WASM apps are not working in VS2019 nor VS2022. Also, the new Hot reload is not working for me. I think something is not correctly set on my laptop, but I'm not sure what. I'll be monitoring this post, perhaps you'll get an answer I can use as well ;) – Paul Meems Nov 19 '21 at 14:25
  • Further comment... I did find that by adding the @namespace to my razor pages, making sure they were the same as my razor.cs files namespaces, and also ensuring that the namespaces were correctly set up in the _imports.razor file.. it seems to work. Just check those things and let me know... – Brett JB Nov 19 '21 at 21:11
  • It could be a config problem, many things were changed when the latest bits were released. See [my answer here](https://stackoverflow.com/a/72037574) for working config, albeit for Edge. – lonix Apr 28 '22 at 03:34

0 Answers0