C#: Use list protocol for ExceptionFilteredTry catch filters in RPC#7080
Draft
knutwannheden wants to merge 7 commits intomainfrom
Draft
C#: Use list protocol for ExceptionFilteredTry catch filters in RPC#7080knutwannheden wants to merge 7 commits intomainfrom
ExceptionFilteredTry catch filters in RPC#7080knutwannheden wants to merge 7 commits intomainfrom
Conversation
The catch filters in ExceptionFilteredTry were sent/received using manual loops instead of the standard getAndSendList/receiveList protocol. When the C# receiver created a new shell via NewObj (e.g. after RPC restart), the shell's CatchFilters was an empty list, so the receiver consumed zero messages while the sender had sent N filter messages — desynchronizing the RPC stream and causing an InvalidCastException (JLeftPadded<object> → Markers). Fix all four implementations (Java sender/receiver, C# sender/receiver) to use the list primitives which handle ADD/CHANGE/position-matching correctly regardless of the before object's state.
ExceptionFilteredTry catch filters in RPC
Use Guid.Empty as sentinel for null catch filter entries to avoid ArgumentNullException in Dictionary-based position matching.
SendList now handles null elements (e.g. catch clauses without 'when' filters) by sending a simple ADD with no value, which the receiver interprets as null. Previously, null elements passed to Add() caused ArgumentNullException at Reference.GetValueNonNull.
6cc3025 to
33d6463
Compare
Mirror of the C# fix — null list elements are sent as NO_CHANGE to avoid NPE in add()/requireNonNull when lists contain null entries (e.g. ExceptionFilteredTry catch filters without 'when' clauses).
Same fix as Java and C# — null list elements are sent as NO_CHANGE to avoid errors when lists contain null entries.
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.
Summary
getAndSendList/receiveListNewObj(e.g. after RPC restart), the shell'sCatchFilterswas empty, so the receiver consumed zero messages while the sender sent N — desynchronizing the streamInvalidCastException: Unable to cast JLeftPadded<object> to Markerswhen parsing files withcatch ... whenclausesTest plan
catch (Exception ex) when (...), shuts down RPC, and reprints — previously crashed, now passesCSharpRecipeTesttests pass