Skip to content
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

Implement void AsnWriter.Encode #112921

Merged
merged 8 commits into from
Feb 27, 2025

Conversation

vcsjones
Copy link
Member

Closes #112675

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR implements a new void overload for AsnWriter.Encode to provide an encoding callback overload and updates various tests and reference assemblies accordingly. The changes include adding the new overload with XML documentation, updating tests to cover the new API, and cleaning up lambda callback return values in several crypto-related files.

Reviewed Changes

File Description
src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs Added new void Encode overload with accompanying documentation.
src/libraries/System.Formats.Asn1/tests/Writer/SimpleWriterTests.cs Added test cases to validate behavior of the new Encode overload and verify exception conditions when the writer is unbalanced.
src/libraries/System.Formats.Asn1/tests/Writer/Asn1WriterTests.cs Updated tests to check that the callback receives the correct state and encoded data.
src/libraries/System.Formats.Asn1/tests/Writer/PushPopSetOf.cs Added tests to ensure that encoding while unbalanced correctly throws an exception.
src/libraries/System.Formats.Asn1/ref/System.Formats.Asn1.cs Updated reference assemblies with the new void Encode declaration.
Other files (SignerInfo.cs, DSAKeyFormatHelper.cs, X509Pal.Android.cs, X509Pal.macOS.cs) Cleaned up lambda callbacks by removing unnecessary return values to align with the new void overload.

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

vcsjones and others added 2 commits February 26, 2025 12:54
Co-authored-by: kasperk81 <83082615+kasperk81@users.noreply.github.com>
@vcsjones vcsjones merged commit 205abfb into dotnet:main Feb 27, 2025
83 checks passed
@vcsjones vcsjones deleted the impl-asn-encode-callback-void branch March 5, 2025 04:09
@vcsjones vcsjones added this to the 10.0.0 milestone Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: void-returning Encode callback for AsnWriter
4 participants