-
Notifications
You must be signed in to change notification settings - Fork 354
Fix DeepCopy NullReferenceException while preserving null serialization #3330
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
Conversation
Co-authored-by: alexzautke <[email protected]>
Co-authored-by: alexzautke <[email protected]>
Co-authored-by: alexzautke <[email protected]>
|
This PR is fixing a bug report for sdk6 and fixes it in sdk5, so I think this is a bogus PR. |
|
@copilot Account for the comment from @ewoutkramer #3329 (comment) |
I've reviewed the issue and the current repository state. The repository is currently on SDK version 5.13.0, and I don't see any SDK 6 branch or version. The issue description mentions "Versions used: 6.0.1, 5.12.2" - could you clarify what "6.0.1" refers to? Is this:
My changes currently fix the null serialization issue in SDK 5.13.0. Should I:
Please advise on the appropriate action. |
|
@copilot Rebase the PR with the current develop and you'll that there's an SDK 6 |
Rebased onto SDK 6 develop branch (v6.0.2). The changes have been updated for the SDK 6 architecture: Modified files for SDK 6:
Tests:
The SDK 6 architecture differs from SDK 5 - the serialization logic moved from |
|
@copilot Based on the comment in #3329 (comment) you should have kept the support for serializing nulls and not skip them. Just avoid the null pointer exception when doing the DeepCopy. |
Updated the implementation per your feedback (commit 2717f9a). Changes:
Tests confirm:
All 4 tests passing. |
Null entries in FHIR resource collections (Extension, Identifier, etc.) were causing NullReferenceException during DeepCopy operations in SDK 6.
Changes
Updated for SDK 6 (v6.0.2)
This PR has been rebased onto the SDK 6 develop branch to target the correct version where the bug was reported.
DeepCopy
Base.Extensions.DeepCopyInternal<T>()to handle null items without throwing NullReferenceExceptionitem is not null ? item.DeepCopy() : null!Serialization Behavior
Tests
FhirJsonSerializer/FhirXmlSerializer)Example
SDK 6 Architecture: The DeepCopy logic is in
Base.Extensions.csin SDK 6 (moved fromIDeepCopyable.csin SDK 5).Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.