-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GraphStageLogic.ConcurrentAsyncCallback throws NRE when used with ChannelSource #7808
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
GraphStageLogic.ConcurrentAsyncCallback throws NRE when used with ChannelSource #7808
Conversation
Arkatufus
left a comment
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.
Self-review
| handler1(e); | ||
| else | ||
| throw new ArgumentException( | ||
| $"Expected {nameof(obj)} to be of type {typeof(T)}, but was {obj.GetType()}"); |
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.
The NRE was thrown here by obj.GetType() when obj is null.
The actual fix was to make sure that this wrapper also handles null and passes it to the handler delegate
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.
Note, this should be fixed using #nullable enable later to make it explicit that T can be null
Aaronontheweb
left a comment
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.
Changes look tentatively good to me, so long as the test suite agrees
…nnelSource (akkadotnet#7808) (cherry picked from commit 4168945)
Fixes #7794
Changes
Make sure ConcurrentAsyncCallback can handle null events properly.
Actual Bug
ChannelSource.OnReaderCompleteaccepts a nullableExceptionas an argument (null sentinel) and was passed in as a logic async callback.ConcurrentAsyncCallbackwould not accept null as a value and considered it as an invalid event and tried to raise anArgumentExceptionexception.ConcurrentAsyncCallbackthrows aNullReferenceExceptionbecause it tried to callobj.GetType()inside string extrapolation becauseobjis null.