Blazor sample app slow loading while develop

Ludovico M 6 Reputation points
2022-06-15T07:30:34.587+00:00

I created a new Blazor Web Assembly app from visual studio 2022, and I got the usual template application with a counter button

211507-image.png

When I run this app from my development machine, the first load take 20 seconds. Every time I change something in the code and re-run the application it takes 20 seconds to load.

Is this the normal behaviour or do I have something wrong on my development machine?

It's very hard to develop something if you have to wait 20 seconds everytime you want to test a modification

Looking at the network tab of the browser I see this:

211545-image.png

As you can see 21.76 MB of resource are cached, and only 0.04 MB are downloaded from the network. So why does it take so long?

Do you have the same times while coding?

Developer technologies .NET Blazor
{count} vote

4 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-06-15T18:13:54.343+00:00

    why aren't you using hot load?

    when you run the app a lot happens

    1) code compiled
    2) server site loaded into iis (express)
    3) debugger attaches to server code
    4) browser start with site url
    5) blazor client code started
    6) blazor client code loads debugging tools and WASM
    7) debugger attaches to browser

    your performance will depend on your machine. on my box (windows VM on a IMac Pro) it takes 12 seconds.

    0 comments No comments

  2. Ludovico M 6 Reputation points
    2022-06-16T06:44:19.867+00:00

    I use hot reload but, half of the time, it still needs a rebuild of the application that take the usual 20 seconds

    Note that I'm not talking about debugging an application, even if I launch it without debug it still takes 20 seconds everytime. The problem is surely not my pc (a brand new I7 11th gen with 32Gb of ram), also the 12 seconds that you got are very high in my opinion.

    I'm used to asp.net that is instantaneous to launch, but I find it hard to believe that blazor wasm is like that


  3. AlexChow 11 Reputation points MVP
    2022-12-07T21:31:09.58+00:00

    you cant try work with dotnet watch

    0 comments No comments

  4. Ludovico M 6 Reputation points
    2023-05-04T12:51:19.7433333+00:00

    I found the problem. For me it was the antivirus in use in my company, ESET.
    Disabling the antivirus is not solving the issue, I had to completely remove it to come back to normal development times

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.