GraphStageLogic.ConcurrentAsyncCallback throws NRE when used with ChannelSource#7808
Merged
Aaronontheweb merged 1 commit intoSep 4, 2025
Conversation
This was referenced Sep 4, 2025
Arkatufus
commented
Sep 4, 2025
| handler1(e); | ||
| else | ||
| throw new ArgumentException( | ||
| $"Expected {nameof(obj)} to be of type {typeof(T)}, but was {obj.GetType()}"); |
Contributor
Author
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
Note, this should be fixed using #nullable enable later to make it explicit that T can be null
Aaronontheweb
approved these changes
Sep 4, 2025
Member
Aaronontheweb
left a comment
There was a problem hiding this comment.
Changes look tentatively good to me, so long as the test suite agrees
Arkatufus
added a commit
to Arkatufus/akka.net
that referenced
this pull request
Sep 5, 2025
…nnelSource (akkadotnet#7808) (cherry picked from commit 4168945)
This was referenced Sep 10, 2025
This was referenced Sep 23, 2025
This was referenced May 21, 2026
Open
Closed
Open
Open
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.