-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Blazorserver Byte Array Interop Support #32259
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
Closed
Closed
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3ec093b
Update BlazorPackHubProtocolWorker to support byte[][]
TanayParikh f698466
Cleanup
TanayParikh 73fe206
Blazor Server Byte Array Interop
TanayParikh 0b9c276
Update PublicAPI.Shipped.txt
TanayParikh 8ee28b3
Merge branch 'main' into taparik/blazorserverByteArrayInterop
TanayParikh 2fd4b22
Tests
TanayParikh d2a2b73
DotnetDispatcher.Invoke returns byte arrays
TanayParikh 73de509
Merge branch 'main' into taparik/blazorserverByteArrayInterop
TanayParikh ef647e7
Merge branch 'main' into taparik/blazorserverByteArrayInterop
TanayParikh 72ae8c1
Fix conflict
TanayParikh c788639
Cleanup
TanayParikh fe513a4
API Updates
TanayParikh 3056f46
Serialized Args
TanayParikh 05dd8ab
Utilize List for byte[][] in BlazorPack
TanayParikh a0dc457
Fix build
TanayParikh 9995e90
Refactored and Guarded Serialization
TanayParikh 8aeef7d
Added byte array json converter semaphores
TanayParikh cdba736
Utilize ArrayBuilder
TanayParikh b0b5a6b
Update signatures to leverage SerializedArgs
TanayParikh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,7 +336,7 @@ public async Task OnRenderCompletedAsync(long renderId, string errorMessageOrNul | |
|
||
// BeginInvokeDotNetFromJS is used in a fire-and-forget context, so it's responsible for its own | ||
// error handling. | ||
public async Task BeginInvokeDotNetFromJS(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson) | ||
public async Task BeginInvokeDotNetFromJS(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson, byte[][]? byteArrays) | ||
{ | ||
AssertInitialized(); | ||
AssertNotDisposed(); | ||
|
@@ -347,7 +347,7 @@ await Renderer.Dispatcher.InvokeAsync(() => | |
{ | ||
Log.BeginInvokeDotNet(_logger, callId, assemblyName, methodIdentifier, dotNetObjectId); | ||
var invocationInfo = new DotNetInvocationInfo(assemblyName, methodIdentifier, dotNetObjectId, callId); | ||
DotNetDispatcher.BeginInvokeDotNet(JSRuntime, invocationInfo, argsJson); | ||
DotNetDispatcher.BeginInvokeDotNet(JSRuntime, invocationInfo, argsJson, byteArrays); | ||
}); | ||
} | ||
catch (Exception ex) | ||
|
@@ -362,7 +362,7 @@ await Renderer.Dispatcher.InvokeAsync(() => | |
|
||
// EndInvokeJSFromDotNet is used in a fire-and-forget context, so it's responsible for its own | ||
// error handling. | ||
public async Task EndInvokeJSFromDotNet(long asyncCall, bool succeeded, string arguments) | ||
public async Task EndInvokeJSFromDotNet(long callId, bool succeeded, string resultOrError, byte[][]? byteArrays) | ||
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. Ah yes, these are better names. Thanks for cleaning this up! |
||
{ | ||
AssertInitialized(); | ||
AssertNotDisposed(); | ||
|
@@ -374,14 +374,14 @@ await Renderer.Dispatcher.InvokeAsync(() => | |
if (!succeeded) | ||
{ | ||
// We can log the arguments here because it is simply the JS error with the call stack. | ||
Log.EndInvokeJSFailed(_logger, asyncCall, arguments); | ||
Log.EndInvokeJSFailed(_logger, callId, resultOrError); | ||
} | ||
else | ||
{ | ||
Log.EndInvokeJSSucceeded(_logger, asyncCall); | ||
Log.EndInvokeJSSucceeded(_logger, callId); | ||
} | ||
|
||
DotNetDispatcher.EndInvokeJS(JSRuntime, arguments); | ||
DotNetDispatcher.EndInvokeJS(JSRuntime, resultOrError, byteArrays); | ||
}); | ||
} | ||
catch (Exception ex) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
FYI this is bad, length comes from user provided input, so you cannot pre-allocate the array.
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.
Good call.
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.
Thanks, updated to utilize a list for the result.