Questions tagged [blazor-jsinterop]
80 questions
15
votes
2 answers
JSRuntime is not registered Blazor
I have a Blazor Wasm project and when I want to inject the JSRuntime
@inject JSRuntime js
I'm getting this error:
"Cannot provide a value for property 'js' on type 'BlazorApp.Pages.Page'. There is no registered service of type…

SamBerk
- 311
- 2
- 10
12
votes
3 answers
The assembly does not contain a public invokable method with [JSInvokableAttribute]
We use Blazor WebAssembly and I want to call an non-static method in my Index.razor-File by JavaScript.
JavaScript:
(function () {
// keydown event
window.addEventListener("keydown", function (e) {
…

Simon
- 4,157
- 2
- 46
- 87
11
votes
1 answer
Error: Microsoft.JSInterop.JSException: Converting circular structure to JSON in .NET7
I have created a Blazor Server application in .NET6.but recently I've upgraded it to.NET7.since this time,i am getting above issue .
Error: Microsoft.JSInterop.JSException: Converting circular structure to JSON
--> starting at object with…

buddhi chamalka
- 781
- 5
- 23
4
votes
1 answer
Blazor: How to call StateHasChanged after a JSInterOP invoke (try to get the BwoserResolution to Blazor App after a resize via JS resize Event)?
in the last days I'am trying to read out the browser resolution in my blazor app. I'am trying to do it this way: [JSInvokable] Blazor Methode is invoked by a JS script.
1.
My question is: The width and height is only shown in my blazorpage after I…

nogood
- 1,117
- 1
- 11
- 34
4
votes
1 answer
In Blazor Server, is order of js interop calls guaranteed?
GIVEN that
I have let's say an onscroll or mousemove javascript eventhandlers, that invokes a C# method on the server:
THEN
is order of the C# method invocations guaranteed on the server?
e.g following…

Liero
- 25,216
- 29
- 151
- 297
3
votes
0 answers
Blazor Java script interop
I have this javascript library that is written in TypeScript
(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f()
} else if (typeof define === "function" && define.amd) {
…

Ubhaya Kalanamiththa
- 63
- 8
3
votes
1 answer
Blazor calling JSInterop script that builds UI fails to render correctly
I'm trying to get this to work as per Microsoft's documentation.
The below script code works perfectly in an existing React app and I'm trying to port the app to Blazor. The script loads and inits - and I can see the Iframe being correctly loaded…

robuk
- 85
- 1
- 5
3
votes
1 answer
Blazor JS Interop getElementById to get component reference
I need, in Blazor, get a reference to a component by its ID.
Note: Not using ElementReference, as it is for generic code.
I've used this JS Interop script to do a focus and it works fine for me:
public async Task Focus(string elementId){
…

Antonito
- 77
- 1
- 9
3
votes
2 answers
Screen rendering issues when using IJSRuntime Blazor
First of all, I am very sorry for my English skills.
I am currently developing a web project through dotnet core 3.1 blazor.
As in the source below, I use IJSRuntime to call a Javascript function that takes a long time.
[Inject]
IJSRuntime JSRuntime…

GT Kim
- 31
- 3
3
votes
0 answers
Blazor WebAssembly getting a "memory access out of bounds error" when returning an image from JSInterop call
I have a Blazor WebAssembly application capturing video from the computer webcam. The video Element linked to the webcam is hidden. The Video feed is painted to an HTML canvas element.
I am using JSInterop to call GetImageData() on the canvas. The…

Newbee
- 173
- 1
- 8
3
votes
2 answers
Blazor: Invoking C# static method from JS function called from HTML onclick--why can't the JS find the method?
Inside a Blazor component, I want to call a JS method from the HTML onclick event of an anchor tag, thus:
@DisplayName
My JS method is:
window.LoadImage = () => {
…

MadBanana
- 35
- 1
- 6
3
votes
1 answer
How to run bundled javascript files in blazor web assembly?
I have kept the bundled script files in wwwroot folder of blazor_wasm app.
I added the file using script tags in index.html