Conversation
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.
Addresses review finding R31.
A
static async voidmethod marked[UpgradeTo]currently passes signature validation, but generated deserialization invokes it synchronously and completes its writer when the method returns. An incomplete await can therefore omit upgraded fields and make the continuation throw when it writes to the completed payload. The review reproduced an old name-mode payload containingValue=42returning withValue=0.This change rejects async upgrade methods with the existing CN0018 error and makes the diagnostic explain that methods must be non-async. It also checks a partial method's implementation: Roslyn exposes the declaration without its implementation's async modifier, so
IsAsyncalone leaves that path unprotected. The README now states that every upgrade write must finish before the method returns.Regression coverage includes async void with and without await, an async partial implementation with the attribute on either part, a synchronous partial control, and Task/Task return signatures with and without async. The existing ordinary synchronous void control remains valid.
Validation on Windows using SDK 10.0.400, the existing Roslyn 5.6.0 references, and the .NET 8 runtime:
IsAsynccheck alone still failed both partial-method cases.dotnet test Cat.Network.sln --configuration Release --no-restorepasses all 237 tests: 155 runtime, 62 analyzer, and 20 generator.This tightens the compile-time contract; existing async void upgrades, including those without await, now fail compilation when the analyzer is enabled. CN0018 remains an error with the same identifier. The generator, runtime, wire format, dependencies, and SDK settings are unchanged, and this patch adds no awaitable upgrade API. Suppressing or omitting the analyzer still bypasses this validation; synchronous methods must also avoid scheduling writes after they return. No other review fix is required for this change.