GithubHelp home page GithubHelp logo

Upgrading Blazor WebAssembly to 3.1.0-preview4.19579.2 leads to an error: Could not find 'BlazorExtensions' in 'window'. about signalr HOT 10 CLOSED

blazorextensions avatar blazorextensions commented on June 26, 2024 4
Upgrading Blazor WebAssembly to 3.1.0-preview4.19579.2 leads to an error: Could not find 'BlazorExtensions' in 'window'.

from signalr.

Comments (10)

szmalec avatar szmalec commented on June 26, 2024 2

It looks that we can now forget about problems with Blazor Extensions SignalR and use Microsoft.AspNetCore.SignalR.Client directly - see "Support for the .NET SignalR client" section @ https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-1-release-now-available/

from signalr.

galvesribeiro avatar galvesribeiro commented on June 26, 2024 2

@szmalec Yes, the SignalR client is now supported on WebAssembly as expected.

One quick note... Before you blame "Blazor Extensions SignalR problems", please read the real reason why it has problems before start attacking others.

For future readers, the problem is caused because Blazor changed the way it deals with static content (CSS/JS) and that breaks every single extension out there making components useless.

As stated here we are working on bring a solution for this issue that doesn't requires manual interaction with JS/CSS files by the final user otherwise, it will not make any sense at all. It beats the purpose of a NuGet package in its essence.

from signalr.

szmalec avatar szmalec commented on June 26, 2024 1

In szmalec@0d8fe51 you can see modified Blazor.Extensions.SignalR version which works OK after update to 3.1.0-preview4.19579.2.
As you probably discover there are some drawbacks:

It looks that previously existed entry <EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" /> in Blazor.Extensions.SignalR.JS.csproj is not taken into account (is not used)?

Am I wrong at any of above points?


So if anyone wants to have 3.1.0-preview4.19579.2 and Blazor.Extensions.SignalR then can use my temporary solution.
Otherwise maybe it would be better to wait, because there are some currently unresolved issues which have "asset" in title, eg. for blazor-wasm-3.2-preview1...

from signalr.

TroelsL avatar TroelsL commented on June 26, 2024 1

Ran into the same issue, even managed to replace the BlazorExtensions.Storage with another solution before finding out what the root issue was.

I'd very much also appreciate a bit more elaborate (or dumbed down, if you will) set of workaround steps if anyone is able and willing. I haven't been able to locate another solution for doing SignalR in Blazor WASM.

from signalr.

coj337 avatar coj337 commented on June 26, 2024 1

It's just a temporary fix until the proper patch is merged in but you can compile the js manually and reference that from your index.html
(Here's mine if you're lazy, just change the extension to js blazor.extensions.signalr.txt)

from signalr.

AlexanderJohnston avatar AlexanderJohnston commented on June 26, 2024

I cannot find the Blazor.Extensions.SignalR.JS file to put into my _content folder. Where are you guys getting that? Everything makes sense except for that piece of the puzzle.

This issue is blocking my team from doing any work right now. Do we have any fixes? I tried following what you guys are talking about up above but I cannot reproduce your fix.

from signalr.

cmoski avatar cmoski commented on June 26, 2024

I was able to get around this issue by creating a new Razor Class Library, and adding: https://github.com/BlazorExtensions/SignalR/files/4007658/blazor.extensions.signalr.txt (renamed to .js) to RazorClasssLibrary\wwwroot\Blazor.Extensions.SingalR.js and adding the following:

<script type="text/javascript" src="_content/RazorClasssLibrary/Blazor.Extensions.SignalR.js"></script> to index.html

Once I did this, it appears the websocket was at least connecting. (Although I don't have more information on if there is a better place to put this reference.)

from signalr.

PierpaoloBattaglioneSpecifi avatar PierpaoloBattaglioneSpecifi commented on June 26, 2024

Actually with all the changes made in @szmalec's branch everything works, even in WebAssembly. Is this project still maintained? Can we open a PR?

Are we waiting for blazor-wasm-3.2-preview1 to be released?

from signalr.

EugeneScully avatar EugeneScully commented on June 26, 2024

Are we waiting for blazor-wasm-3.2-preview1 to be released?

It looks like a SignalR client is scheduled for 3.2-preview3:
https://github.com/dotnet/aspnetcore/milestone/81
dotnet/aspnetcore#13503

from signalr.

szmalec avatar szmalec commented on June 26, 2024

@galvesribeiro
I didn't want it to sound like that. I know that SignalR Blazor Extensions should not be blamed for problems resulting from changes in the WASM Blazor - which is still in preview phase.
I just hoped that using the official SignalR client could be a better idea to bypass the likely temporary issues reported in this issue.

I know that SignalR Blazor Extensions is a piece of awesome work - thank you for your commitment and willingness to share the results of your hard work with the community!!

Now I also know that the recommendation of switching to the official Microsoft.AspNetCore.SignalR.Client in the WASM Blazor apps was not necessarily a good move (at least for now when blazor wasm is not officialy production ready), because after migration I encountered other problems (related to JWT auth) which I mention here (comment still not moderated - so not publicly available) ;)

So again - we should remember that Blazor WASM is still an alpha phase;)

from signalr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.