Skip to content

Conversation

@BrennanConroy
Copy link
Member

Fixes #45168

Our check for if a result existed for a completion message didn't handle false or null results.

@BrennanConroy BrennanConroy added area-signalr Includes: SignalR clients and servers feature-client-javascript Related to the SignalR JS client labels Nov 18, 2022
@campersau
Copy link
Contributor

Or other javascript falsy values like "" and 0 I guess.

@BrennanConroy
Copy link
Member Author

Or other javascript falsy values like "" and 0 I guess.

Isn't javascript great... 😆


private _writeCompletion(completionMessage: CompletionMessage): ArrayBuffer {
const resultKind = completionMessage.error ? this._errorResult : completionMessage.result ? this._nonVoidResult : this._voidResult;
const resultKind = completionMessage.error ? this._errorResult :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if completionMessage.error is an empty string instead of undefined or null? Should that be treated as an error result still?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, any non-null value should be considered an error. I don't think there is anyway today for an empty string to be set, but even if it was that should be considered an error.
In theory we should throw for both error and result being set, but since I want to backport this change, and we control the creation of completion messages it would basically only be an assert, I'm not going to add that.

@amcasey amcasey merged commit 115892e into main Dec 12, 2022
@amcasey amcasey deleted the brecon/undefined branch December 12, 2022 23:38
@ghost ghost added this to the 8.0-preview1 milestone Dec 12, 2022
@amcasey
Copy link
Member

amcasey commented Dec 12, 2022

Offline sign-off from @halter73

@ghost
Copy link

ghost commented Dec 12, 2022

Hi @amcasey. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

@BrennanConroy
Copy link
Member Author

/backport to release/7.0

@github-actions
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers feature-client-javascript Related to the SignalR JS client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISingleClientProxy.InvokeAsync<T> throwing System.Exception upon receiving return value from client invocations using messagepack protocol

6 participants