-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Blazor Byte Array Interop Support #33015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
e538e9b
137a5f1
e56bf6f
66815f3
18ade7c
4a006e6
8293e92
99c2b2c
fc7d066
b533959
1780543
72dae17
f74f93f
d4fc26e
108b9f2
6285ba1
4c3edd6
db57f3a
514d320
11e2ceb
a66eac6
f710bd0
02b2b75
b6b2fdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,6 +209,17 @@ public async ValueTask EndInvokeJSFromDotNet(long asyncHandle, bool succeeded, s | |
_ = circuitHost.EndInvokeJSFromDotNet(asyncHandle, succeeded, arguments); | ||
} | ||
|
||
public async ValueTask SupplyByteArray(long id, byte[] data) | ||
{ | ||
var circuitHost = await GetActiveCircuitAsync(); | ||
if (circuitHost == null) | ||
{ | ||
return; | ||
} | ||
|
||
await circuitHost.SupplyByteArray(id, data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pranavkm it's fine if we don't await things here. The methods in |
||
} | ||
|
||
public async ValueTask DispatchBrowserEvent(string eventDescriptor, string eventArgs) | ||
{ | ||
var circuitHost = await GetActiveCircuitAsync(); | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still doing
ToArray
in place of passing through theReadOnlySequence<byte>
.Concerns with using the
ReadOnlySequence
relate to the fact that it doesn't implicitly cast tobyte[]
so when we're examining method parameters we have a type mistmatch.Additionally, as Javier mentioned in the other PR we need to verify the lifecycle/ownership of the
ReadOnlySequence
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'd need to change the receiving code (
ComponentHub.SupplyByteArray
) to accept aReadOnlySequence<byte>
instead of abyte[]
, so there wouldn't be a type mismatch.Agreed on verifying the ownership of the buffer before doing that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, lets keep it as is for the time being and then we can do a quick check and change afterwards.