Description
Describe the bug
A newly published Blazor Webassembly .net 5 app fails to start in the browser with Integrity check failures. Have several applications which have run fine on .net5 for months. In the week of .net 6 being released they've started to fail when a new version is published (no idea if it's the .net 6 release, whether it's moving to VS2022, or they're both a coincidence). It's not every single time, but it's now a common issue that has never occurred prior to w/c 8th November 2021.
Developed on Windows 10, Production systems are on Linux behind Nginx. Cleaning the build before publish doesn't fix the problem. Manually deleting the bin and obj folders in the Client and Server Projects makes the problem go away (is probably just the Client project that needs deleting tbh).
To Reproduce
Blazor WebAssembly Self Hosted app on Windows 10, VS2022. Right click on the server project and publish. Publish to a folder, zip up and copy to the Linux server. after starting the app appears to start and then does nothing. But the browser console has the errors shown in the Exception section below. Error log also attached.
With no code changes, no csproj changes, no nuget changes, I can reliably make the problem go away by deleting the bin and obj folders in the projects, performing the steps above and the Blazor app starts.
Exceptions (if any)
app.sharperpages.com/:1 Unknown error occurred while trying to verify integrity.
app.sharperpages.com/:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://app.sharperpages.com/_framework/HtmlAgilityPack.dll' with computed SHA-256 integrity 'OwW+oeVwPiItyx8Oy+kaasZrJOndOzmKFF6WSddzFFI='. The resource has been blocked.
app.sharperpages.com/:1 Unknown error occurred while trying to verify integrity.
blazor.webassembly.js:1 Error: Failed to start platform. Reason: TypeError: Failed to fetch
at blazor.webassembly.js:1
at blazor.webassembly.js:1
at Object.throw (blazor.webassembly.js:1)
at s (blazor.webassembly.js:1)
d.printErr @ blazor.webassembly.js:1
Further technical details
- ASP.NET Core version:
- The IDE (VS / VS Code/ VS4Mac) you're running on,
- VS Studio 2022 Community Edition on Windows 10
app.sharperpages.com-1637492813346.log
and its version: - Include the output of
dotnet --info
:
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.100\
Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa
.NET SDKs installed:
5.0.201 [C:\Program Files\dotnet\sdk]
6.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]