Skip to content

Blazor unbelievably slow to build and reconnect #15264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
redowl3 opened this issue Oct 22, 2019 · 13 comments
Closed

Blazor unbelievably slow to build and reconnect #15264

redowl3 opened this issue Oct 22, 2019 · 13 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@redowl3
Copy link

redowl3 commented Oct 22, 2019

Describe the bug

When building a Blazor Server Side project of any significant size the time it takes to make a change to a .razor component is unbelievably slow.

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Using .net core 3.0 Visual Studio 2019
  2. Create a Blazor Server Side project with a couple of references to other projects in the solution (Model, Data etc..)
  3. Add say 20 razor components
  4. Add Ignore Linker code to project
  5. Ctrl + F5 to start project
  6. Change a single html element in one of the components

Expected behavior

I've seen 4 seconds quoted as reasonable time for change to take effect

Actual behavior

It can take up to 30 seconds for project to rebuild and be able to resume

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

My machine is running an Intel Core i7 processor

Include the output of dotnet --info

Microsoft.NETCore.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@redowl3 redowl3 changed the title Blazor unbeliavably slow to build and reconnect Blazor unbelievably slow to build and reconnect Oct 22, 2019
@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Oct 22, 2019
@javiercn
Copy link
Member

@redowl3 Thanks for contacting us.

Can you run dotnet build /bl from the command-line and attach the generated msbuild.binlog file?

@pranavkm Do we have recompilation for Blazor server-side? (We don't, don't we?).

4. Add Ignore Linker code to project

We don't understand what you mean by this.

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Oct 22, 2019
@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

Hi, thanks for the response.

Will run dotnet build /bl and get back to you.

Add Ignore Linker code to project file meant

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <BlazorLinkOnBuild>false</BlazorLinkOnBuild> </PropertyGroup>

@javiercn
Copy link
Member

false

This is only applicable to blazor wasm.

@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

ok thanks, was suggested on Gitter channel

@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

binlog.txt

Hopefully what was needed?

@javiercn
Copy link
Member

@redowl3 Not quite.

You need to run dotnet build /bl from the command line and it will generate a file msbuild.binlog in the same folder.

Also, just to clarify, does it take a long time to build the app or are you trying to change/update the app while it is running?

@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

msbuild.txt

Renamed to allow it to upload.

Yes, trying to change/update the app while running. I've tried it using the default server side project and it takes a couple of seconds, trying it with a reasonable sized solution seems to be the issue.

Thanks

@mkArtakMSFT mkArtakMSFT added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Oct 22, 2019
@mkArtakMSFT mkArtakMSFT added this to the blazor-wasm milestone Oct 22, 2019
@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

Not sure if this is relevant, but noticed that VS is busy processing tasks when I press save (even though nothing has changed) at one point it had 12 tasks on the go although a couple were paused.

image

@javiercn
Copy link
Member

@redowl3 That can definitely be causing issues.

From what I see on the binlog the build (which seems to be a clean build) takes about 18 seconds. If you add to that a few additional seconds that it takes for the app to be torn down and the new app to launch, I think you get your 30 seconds.

My belief is that something might be breaking your incremental compilation. I tried to repro this creating a huge amount of components on a new app (like 40 or so) and it doesn't repro for me.

I would look at other processes that might be running at the same time and slowing down your build. I'm doing this from a laptop.

I'm closing this issue as this doesn't seem to be an issue in the general case, but an issue with your environment.

@redowl3
Copy link
Author

redowl3 commented Oct 22, 2019

Do you have any more information on breaking your incremental compilation?

Also did you add a project references to the project? And last question, any idea why the process is getting kicked off on Save when nothing has changed?

@javiercn
Copy link
Member

@redowl3 You can capture the builds as visual studio makes them following the steps in https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#visual-studio-2017-or-later

Then you can use the timeline view on MSBuild structured log viewer to see where the time is being spent on the build.

@pranavkm
Copy link
Contributor

@redowl3 these might not amount to much, but perhaps a couple of things you could do here:

a) The AccountableUK.Web project references the Microsoft.AspNetCore.Blazor package which is meant for Blazor WASM. If you're attempting to build a server-side project, I'd start by removing this reference from your project. Having it causes the Component's analyzer to run twice for each compile, which would definitely slow things down.

b) This is a shot in the dark, but in an earlier preview release the compiler had an issue with analyzers. It looks like you are using an SDK \ compiler that should have addressed the issue, but perhaps you could give the workaround a try:

In your project file, add the following:

<PropertyGroup>
    <DisableImplicitAspNetCoreAnalyzers>true</DisableImplicitAspNetCoreAnalyzers>
</PropertyGroup>

c) Could you try doing two consecutive rebuilds of your Web project? Command line should be fine to start with.

@redowl3
Copy link
Author

redowl3 commented Oct 23, 2019

Hi, thanks for further information - I can't see where Microsoft.AspNetCore.Blazor is being directly referenced?

@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

4 participants