Is there an existing issue for this?
Describe the bug
Have been struggling with an issue where a hub connection in my .Net6 Blazor apps cause the browser (both Chrome and Edge) CPU to max out over time (10 mins to several hours), causing the apps to become unresponsive. This is only occurring when using Visual Studio 2022 and .Net6, and self-hosting.
I created 2 extremely simple test apps, one in VS2019/.Net5 and the other in VS2022/.Net6 (both Enterprise). They are the same except for the versions. Have tried on 3 different PCs with similar results. The CPU for the browser as viewed in Task Manager begins an upward trend until it reaches 20% +. This can take 30 minutes or more. The .Net5 app generally remains < 1%.
This occurs even if no listeners are configured, though the upward trend is much faster if messages are being received.
Expected Behavior
It is expected that the browser CPU remains low, as it does when using .Net5.
Steps To Reproduce
Example is at https://github.com/bryan-arn/_SignalRCpuDev
For the example, the solution creation overview is:
- Create new Blazor app - .Net6, no authentication, no HTTPS, Core Hosted
- Add Hub class and map endpoint in Program.cs - endpoints.MapHub("/serviceHub");
- Add class to use as BackgroundService, add as hosted service in Program.cs - builder.Services.AddHostedService();
- Use BackgroundService to connect to hub and send current time every second (or however long specified in delay) as string to hub.
- In Index.cs, connect to hub, add receiver for 'receiveText' method and populate label.
So it is an extremely simple SignalR app.
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
Microsoft Visual Studio Enterprise 2022 (64-bit)
Version 17.0.4
Standard Blazor Webassembly template
Output from dotnet --info:
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.407 [C:\Program Files\dotnet\sdk]
6.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Is there an existing issue for this?
Describe the bug
Have been struggling with an issue where a hub connection in my .Net6 Blazor apps cause the browser (both Chrome and Edge) CPU to max out over time (10 mins to several hours), causing the apps to become unresponsive. This is only occurring when using Visual Studio 2022 and .Net6, and self-hosting.
I created 2 extremely simple test apps, one in VS2019/.Net5 and the other in VS2022/.Net6 (both Enterprise). They are the same except for the versions. Have tried on 3 different PCs with similar results. The CPU for the browser as viewed in Task Manager begins an upward trend until it reaches 20% +. This can take 30 minutes or more. The .Net5 app generally remains < 1%.
This occurs even if no listeners are configured, though the upward trend is much faster if messages are being received.
Expected Behavior
It is expected that the browser CPU remains low, as it does when using .Net5.
Steps To Reproduce
Example is at https://github.com/bryan-arn/_SignalRCpuDev
For the example, the solution creation overview is:
So it is an extremely simple SignalR app.
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
Microsoft Visual Studio Enterprise 2022 (64-bit)
Version 17.0.4
Standard Blazor Webassembly template
Output from dotnet --info:
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.407 [C:\Program Files\dotnet\sdk]
6.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]