Code Monkey home page Code Monkey logo

Comments (5)

Tewr avatar Tewr commented on June 2, 2024 1

Should JS Interop from JS -> .NET work in a BlazorWorker?

Yes I'm pretty sure this should work.

I think this is a bug introduced when migrating to net8. Also, I can't find the test. Probably means its not covered by a test anymore. I'll try to find to time to debug this week

from blazorworker.

Tewr avatar Tewr commented on June 2, 2024 1

This has been released.

from blazorworker.

graham83 avatar graham83 commented on June 2, 2024

image

Seems like const serializer = new BlazorWorkerJSRuntimeSerializer(); is not recognized in the constructor here.

Getting the exception on 4.1.2 again.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'serialize')
    at BlazorWorkerJSRuntime.js:11:52
    at new Promise (<anonymous>)
    at DotNetObjectProxy.invokeMethodAsync (BlazorWorkerJSRuntime.js:9:16)
    at self.createSubscription (dxfeed.js:44:18)
    at Object.workerInvokeAsync [as WorkerInvokeAsync] (BlazorWorkerJSRuntime.js:73:26)
    at invoke-js.ts:201:31
    at Ul (invoke-js.ts:276:5)
    at dotnet.native.wasm:0x1faef
    at dotnet.native.wasm:0x1bf8c
    at dotnet.native.wasm:0xf173
    ```

from blazorworker.

Tewr avatar Tewr commented on June 2, 2024

To call static methods, line 7 and 8 in the example from my pr should work already in current version. However calling instance methods with DotNetObjectReference was completely broken, but I'm confident this PR will fix it. I'll see if I have the time to test this a tad more and create a release next week. In your example code you mixed up the concepts a bit as you are trying to call a static method using a DotNetObjectReference

from blazorworker.

graham83 avatar graham83 commented on June 2, 2024

Thanks! Tested today with the DotNetObjectReference method fix in your PR and is working now. Seems like my example was leftover code after trying to refactor to JSExport, thanks for correcting! Will defo use the next release when you merge. Also kudos for the JSDirect implementation, as will replace a bunch of chained calls my code to hit the main js! Top work!

from blazorworker.

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.