Open MackinnonBuck opened 4 years ago
Is there a workaround?
Just to make it clear: As I get it: ElementReference
is a platform-independent Blazor concept, not a JS concept. So you should use IJSObjectReference
when passing JavaScript references that do not map to what Blazor keeps track of as part of its render tree.
Issues arise when using older libraries that are using ElementReference
but not IJSObjectReference
which is quite new.
Community-provided BlazorCanvas, for example. Images to be drawn required to be passed as ElementReference
which does not allow for dynamic loading in JavaScript - since you cannot and should not return an ElementReference
from JavaScript. The reason is that it is not being tracked by Blazor and does not have an id,
However, you can pass an ElementReference
to JavaScript since it then represents an actual element rendered by Blazor.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Thanks for contacting us.
We're moving this issue to the .NET 8 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Thanks for contacting us.
We're moving this issue to the .NET 9 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Describe the bug
When using
IJSRuntime.InvokeAsync<ElementReference>(...)
to invoke a JS function that returns an HTML element, the following exception is thrown:This exception happens regardless of whether the HTML element being returned from the JS function is being passed in from .NET as an
ElementReference
.To Reproduce
See https://github.com/MackinnonBuck/blazor-element-reference-bug. Build and run the Blazor project, then click the button labeled "Return ElementReference from JS". The full exception is displayed in the browser's console.
Exceptions
Further technical details
Blazor WebAssembly project (.NET standard 2.1)
Output of
dotnet --info
:IDE: Visual Studio Enterprise 2019