Replace AsnValueReader with ValueAsnReader and remove internal type#125290
Replace AsnValueReader with ValueAsnReader and remove internal type#125290
Conversation
- Replace AsnValueReader with ValueAsnReader in NegotiateAuthenticationPal.ManagedSpnego.cs - Replace AsnValueReader with ValueAsnReader in CompositeMLDsaTestHelpers.cs - Extract AsnWriterExtensions to its own file - Delete AsnValueReader.cs - Update shared projitems to reference AsnWriterExtensions.cs - Remove projitems import from System.Net.Security.csproj Co-authored-by: vcsjones <361677+vcsjones@users.noreply.github.com>
Co-authored-by: vcsjones <361677+vcsjones@users.noreply.github.com>
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
There was a problem hiding this comment.
Pull request overview
This PR completes the migration away from the internal AsnValueReader by switching remaining call sites to the public ValueAsnReader in System.Formats.Asn1, and then removing the internal implementation from the shared Asn1Reader items.
Changes:
- Replaced remaining
AsnValueReaderusages withValueAsnReaderin SPNEGO parsing and CompositeMLDsa test helpers. - Removed the internal
AsnValueReadertype and split out the still-neededAsnWriterExtensionsinto its own file. - Updated build/project wiring to stop importing the shared Asn1Reader items into
System.Net.Securityand to reference the newAsnWriterExtensions.csfrom the shared projitems.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Net.Security/src/System/Net/NegotiateAuthenticationPal.ManagedSpnego.cs | Updates SPNEGO ASN.1 parsing to use ValueAsnReader instead of the removed internal reader. |
| src/libraries/System.Net.Security/src/System.Net.Security.csproj | Removes the shared Asn1Reader projitems import now that AsnValueReader is no longer used by this project. |
| src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.cs | Updates test helper ASN.1 parsing to use ValueAsnReader. |
| src/libraries/Common/src/System/Security/Cryptography/Asn1Reader/System.Security.Cryptography.Asn1Reader.Shared.projitems | Swaps shared compile item from AsnValueReader.cs to AsnWriterExtensions.cs. |
| src/libraries/Common/src/System/Security/Cryptography/Asn1Reader/AsnWriterExtensions.cs | New standalone file containing the crypto-focused AsnWriter extension helpers. |
| src/libraries/Common/src/System/Security/Cryptography/Asn1Reader/AsnValueReader.cs | Deletes the internal AsnValueReader implementation now that usages have been migrated. |
You can also share your feedback on Copilot code review. Take the survey.
|
@copilot having |
Moved the file and projitems to a new AsnWriter directory since having writer extensions in an Asn1Reader directory was confusing. Updated all 5 csproj imports to reference the new location. Co-authored-by: vcsjones <361677+vcsjones@users.noreply.github.com>
Done in 568b8d9. Moved |
Summary
Replaces all uses of the internal
AsnValueReadertype with the new publicValueAsnReaderfromSystem.Formats.Asn1(introduced in #125254), then removes the internal type entirely.Changes
Type replacement
NegotiateAuthenticationPal.ManagedSpnego.cs— replaced allAsnValueReaderusages withValueAsnReader(6 variable declarations)CompositeMLDsaTestHelpers.cs— replacedAsnValueReaderusages withValueAsnReader(2 variable declarations)File cleanup
AsnValueReader.cs— the internalAsnValueReaderref struct is no longer neededAsnWriterExtensions.cs— extracted theAsnWriterExtensionsclass (which shared the file withAsnValueReader) into its own file under a newAsnWriterdirectorySystem.Security.Cryptography.AsnWriter.Shared.projitems— new shared projitems file in theAsnWriterdirectory referencingAsnWriterExtensions.csAsn1Readerdirectory entirely (deleted the oldSystem.Security.Cryptography.Asn1Reader.Shared.projitems)AsnWriterpath:System.Security.Cryptography.csproj,System.Security.Cryptography.Tests.csproj,System.Security.Cryptography.Pkcs.csproj,Microsoft.Bcl.Cryptography.csproj,Microsoft.Bcl.Cryptography.Tests.csprojSystem.Net.Security.csproj— this project only used the shared items forAsnValueReader; it doesn't useAsnWriterExtensionsValidation
System.Net.Security,System.Security.Cryptography,System.Security.Cryptography.Pkcs,Microsoft.Bcl.Cryptography, and their test projectsAsnValueReaderin the codebase✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.