Change DirectoryNotFoundException binary serialization constructor to use GetValueNoThrow#126648
Conversation
… use GetValueNoThrow Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/722a255e-0a89-4407-bb17-9b9605d62655 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
src/libraries/System.Private.CoreLib/src/System/IO/DirectoryNotFoundException.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/IO/DirectoryNotFoundException.cs
Show resolved
Hide resolved
|
Tagging subscribers to this area: @dotnet/area-system-io |
There was a problem hiding this comment.
Pull request overview
Updates DirectoryNotFoundException binary deserialization to use SerializationInfo.GetValueNoThrow for the optional DirectoryPath field, aligning with patterns used by other exceptions and avoiding a linear scan over SerializationInfo entries.
Changes:
- Replace
foreach (SerializationEntry ...)scan in the serialization constructor with a directGetValueNoThrowlookup.
src/libraries/System.Private.CoreLib/src/System/IO/DirectoryNotFoundException.cs
Show resolved
Hide resolved
|
Note This review was generated by Copilot. 🤖 Copilot Code Review — PR #126648Holistic AssessmentMotivation: The PR simplifies the Approach: This is the right approach. Summary: ✅ LGTM. A clean, one-line simplification that aligns with existing codebase patterns. No behavioral change, no new public API, no risk. Detailed Findings✅ Correctness — Behavioral equivalence verifiedThe old code iterated entries looking for ✅ Consistency — Matches established patternAll other optional-field deserialization sites use
This change eliminates the last divergent pattern. ✅ No public API changes — No ref assembly impactNo changes to
|
|
@danmoseley Minor cleanup |
|
/ba-g trimming test failure is known issue #126675 |
Replace the linear
foreachscan overSerializationInfoentries inDirectoryNotFoundException's deserialization constructor with a directGetValueNoThrowlookup. Consistent other similar constructors in CoreLib..