Fix #4200: Add missing nullable annotations for collection properties… #4216
+10
−4
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.
Fix #4200: Add missing nullable annotations for collection properties in V4
Widespread impact: Resolves nullable reference type regression affecting 27,092 properties across all AWS services - Needs further review.
Root Cause:
Changes:
GENERATOR FIX (generator/ServiceClientGeneratorLib/Member.cs):
EXAMPLE FIX (sdk/src/Services/SQS/Generated/Model/SendMessageBatchResponse.cs):
Impact:
Technical Details:
Closes #4200
Description
This PR fixes a systemic nullable reference type regression in AWS SDK for .NET V4 affecting 27,092 collection properties across all AWS services.
Root Cause: The code generator's
Member.DetermineType()method was missing nullable annotations (?) for collection properties that can be null in V4. This caused runtimeNullReferenceExceptioninstead of compile-time warnings, defeating the purpose of V4's nullable reference type safety.Solution: Modified the code generator to add proper nullable annotations for
Dictionary<>andList<>types when they can be null, enabling proper compile-time null checking.Motivation and Context
This change is required to fix issue #4200 where
SendMessageBatchResponse.FailedandSendMessageBatchResponse.Successfulproperties were missing nullable annotations despite being documented as nullable in V4.The problem affects all AWS services - any collection property with the "Starting with version 4...will default to null" documentation pattern has this issue. This represents a significant gap in V4's nullable reference type implementation.
Links to issue: Fixes #4200
Testing
DetermineType()method now adds nullable annotations for collectionsSendMessageBatchResponseproperties as demonstration?annotations is non-breaking changeTesting Environment: Local development environment with AWS SDK for .NET repository
Test Coverage: Generator logic, example property fixes, DevConfig integration
Screenshots (if appropriate)
Before Fix:
After Fix:
Types of changes
Checklist
License