MihaMarkic / BlazorDevExtreme

Blazor interop for DevExtreme library
MIT License
30 stars 5 forks source link

Not working with server-side Blazor #10

Closed sven5 closed 5 years ago

sven5 commented 5 years ago

Hi Miha,

I'd like to use your lib together with a server-side Blazor app.

I get an error Unable to cast object of type 'Microsoft.AspNetCore.Blazor.Server.Circuits.RemoteJSRuntime' to type 'Microsoft.JSInterop.IJSInProcessRuntime'

Is it possible to change the behavior or add a switch to the lib for server-side?

Thanks Sven

MihaMarkic commented 5 years ago

Can you create a very simple sample for me?

sven5 commented 5 years ago

Hi Miha,

I uploaded a simple solution to my repo: https://github.com/sven5/Blazor-DevExtreme When running the sample you see that the DevExtreme button is not initialized an missing. What I've found out so far is that there is an error when using ((IJSInProcessRuntime)JSRuntime.Current).Invoke. For server-side Blazor it should be something like JSRuntime.Current.InvokeAsync because the JsRuntine is not an in-process runtime.

Thank you Sven

MihaMarkic commented 5 years ago

@sven5 Looking at your repro I see that it isn't working - how did you even find what the error is? Browser nor VS show any message.

MihaMarkic commented 5 years ago

I think I know how to solve it. Hopefully over the weekend.

sven5 commented 5 years ago

Great news!

I think I added the source code as a project to a simple test project and run the debugger, then the plain error came up.

MihaMarkic commented 5 years ago

@sven5 Updated NuGet package to 0.6.1. Give it a try.

sven5 commented 5 years ago

@MihaMarkic

I can confirm it works now. Good job! 👍