Closed PeterDraex closed 1 year ago
hi @PeterDraex, does any of the failing projects serve blazorwasm from an asp.net core backend? currently i am experiencing a similar (may be same) problem (with the mentioned setup). at first sight it seems like the new blazor-unified approach is going to break asp.net-backed wasm solutions. if my setup matches with yours i will try to investigate this and hopefully provide a repro; if not i can proceed with another issue.
Hi @akurone, yes, I'm also using Blazor WebAssembly with ASP.NET Core backend. Thanks for investigating!
Maybe it doesn't help your case but .net 8 rc1 is broken. Try with preview7 or daily rc2 builds.
I'm having a similar issue. Clearing the cache storage seems to fix it:
Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.
I'm having a similar issue. Clearing the cache storage seems to fix it:
I've tried to migrate the project again, and it's working okay. I assume it was the cache issue as @pekspro mentioned. I'll close the issue for now. If anybody is having the same problem and clearing the cache storage doesn't fix it, we can reopen.
I think this issue should be remained open. If an end user run into this, they would probably be stuck.
As an extra protection, I have added a Reload-button on the loading screen. It appears after four seconds, and if the users press that button all caches will be cleared, and the page will be reloaded.
This is my updated load-section:
<div id="app">
<svg class="loading-progress">
<circle r="40%" cx="50%" cy="50%" />
<circle r="40%" cx="50%" cy="50%" />
</svg>
<div class="loading-progress-text"></div>
<div class="loading-reload-text">
<a href="#" id="reload-link">Reload</a>
</div>
<script>
document.getElementById('reload-link').addEventListener('click', function (event) {
event.preventDefault();
caches.keys().then(function (cacheNames) {
return Promise.all(
cacheNames.map(function (cacheName) {
return caches.delete(cacheName);
})
);
}).then(function () {
window.location.reload(true);
});
});
</script>
</div>
And this is my added CSS:
.loading-reload-text {
text-align: center;
opacity: 0;
animation: loading-reload-fade-in 1s ease-in-out 4s forwards;
}
@keyframes loading-reload-fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.loading-reload-text a {
font-weight: 300;
font-size: 90%;
}
I can add that when I switch from .NET 7 to .NET 8, it mostly works fine on my computer, but not every time. On Edge and Chrome on Android I more often get an issue. My error messages from the console (both computer and Android) are:
Error: Failed to start platform. Reason: TypeError: Cannot read properties of undefined (reading 'dotnet.wasm')
at Vt (blazor.webassembly.js:1:62226)
Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at blazor.webassembly.js:1:37659
at blazor.webassembly.js:1:38464
at Object.start (blazor.webassembly.js:1:46018)
at Vt (blazor.webassembly.js:1:62202)
for the follow-up about repro: my problem (#50984) was totally different. so, there is a repro but not for this; sorry :)
Clearing cache storage does not resolve this problem for me (rc2, webassembly standalone)
I get the same error with a completely emty, newly created Blazor WASM AzureB2C project. (dotnet new blazorwasm -au IndividualB2C ....)
@AbstractionsAs, @sequarell, this thread is closed, I doubt anyone is watching :-)
I've created a new thread here: https://github.com/dotnet/aspnetcore/issues/51268
@pekspro @sequarell
I was able to resolve this by:
I noticed that the versions in VS didn't match the packagereference versions. NOthing except actually copy-pasting them in and out actually resolved this.
Seems to be some kind of bug in VS preview.
FWIW, the specific error from the OP (reading 'AspNetCore'
) can happen if you remove the package references to Microsoft.AspNetCore.Components.WebAssembly
from the Blazor wasm project.
Excacly the same issue with the released version from today. Cache storage cleaning doesnt help. The only thing that really helps me was the tip from @AbstractionsAs
Cutting the packagereferences from the .csproj Saving the csproj and waiting for the references to update in VS Pasting the packagereferences back in Clean Rebuild
that works for me
I assume this has to be due to old assets not being cleaned up in the bin/obj folders. Just delete the bin/obj folders, restore the nuget packages, build and run the blazor application.
This also happens if you try to upgrade an old Blazor WebAssembly project that is hosted by an ASP.NET Core app from 7.0 to 8.0. The solution from @AbstractionsAs solves the problem in this scenario too.
I had changed from 7.0 -> 8.0, updated all packaged to 8.0, still received the error.
@AbstractionsAs solution worked for me as well.
I am having this error on Edge browser (chrome works fine) , it's built by GitHub actions and deployed to Cloudflare pages. @AbstractionsAs's solution seems like a local environment solution.
update: as mentioned in another ticket, the issue is cache-related. In my case, cloudflare cdn was caching some files. I triggered purge cache and the issue is gone.
What worked for me was manually deleting the folders under bin\Debug and rebuilding, not deleting the cache. Also it seems that 8.0 now requires a connection to the internet in order to debug aŚ it downloads files from https://raw.githubusercontent.com/dotnet/runtime We had to exclude this path on the proxy to be able to develop.
Same here.
Upgrading from WASM app from 7 to 8.
App refused to load ("Failed to start platform ..." error on console) Only after performing "clean" the app worked.
Just upgraded a hosted WASM app (net7 > 8). Did the cut/paste trick and the browser cache clear and everything started working again.
Had the same problem from .Net 6 to .Net 8 and @AbstractionsAs Solution had worked for me as well.
hey guys, be Simple... Just update to .net 8(from 6/7/any) then manage nuget packages and then update all to lastest probably like 8.0.5 within a minute all fixed... enjoy... nothing else required...
The same thing happens to me with Rider. Just had to delete bin/obj folders and then do a nuget restore making sure all packages were the latest (8.0.6).
What worked for me was manually deleting the folders under bin\Debug and rebuilding, not deleting the cache. Also it seems that 8.0 now requires a connection to the internet in order to debug aŚ it downloads files from https://raw.githubusercontent.com/dotnet/runtime We had to exclude this path on the proxy to be able to develop.
Saved my day. Thanks a lot.
To resolve this issue go to program.cs of your client project(if you are using ASP.NETCORE Hosted blazor WASM) and
replace this
builder.Services.AddHttpClient("yourApplicationName.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
to
builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
this will resolve the error "Failed to start platform. Reason: TypeError: Cannot read properties of undefined (reading 'AspNetCore')"
I've tried to update my solution to .NET 8 RC.1. I've updated all packages and cleaned all
bin
andobj
folders. Still, I ended up with the following error:This error shows up in the browser console when I start the app and open the Blazor client website. Is this a known issue? How can I go about debugging it?
My solution contains 3 distinct Blazor clients. One client works fine after update, two get this error, so I think this will be a common issue. I don't have an example project I could share publicly, but I thought it's worth creating the issue, so when others fail to update to .NET 8 and face the same issue, they can find it, give it a đ or contribute.