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

Enable AOT analyzer in System.Net.HttpListener and System.Net.Http.Json #73191

Merged
merged 3 commits into from
Aug 2, 2022

Conversation

tlakollo
Copy link
Contributor

@tlakollo tlakollo commented Aug 1, 2022

Refactor code in System.Net.HttpListener to be AOT safe
Add annotations to System.Net.Http.Json to mark API as unsafe for AOT

Refactor code in System.Net.HttpListener to be AOT safe
Add annotations to System.Net.Http.Json to mark API as unsafe for AOT
@dotnet-issue-labeler
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, to 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.

@@ -132,7 +132,7 @@ internal void SetServerTimeout(int[] timeouts, uint minSendBytesPerSecond)

SetUrlGroupProperty(
Interop.HttpApi.HTTP_SERVER_PROPERTY.HttpServerTimeoutsProperty,
infoptr, (uint)Marshal.SizeOf(typeof(Interop.HttpApi.HTTP_TIMEOUT_LIMIT_INFO)));
infoptr, (uint)Marshal.SizeOf<Interop.HttpApi.HTTP_TIMEOUT_LIMIT_INFO>());
Copy link
Member

Choose a reason for hiding this comment

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

These are blittable structs and they are passed in into the PInvoke without any marshalling. It would be better to replace this with sizeof(Interop.HttpApi.HTTP_TIMEOUT_LIMIT_INFO). Similar in other places

Copy link
Member

Choose a reason for hiding this comment

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

While you are on it - could you please also delete infoptr local, pass &timeoutinfo directly to the HttpServerTimeoutsProperty method, and replace IntPtr with void* in the implementation of the HttpServerTimeoutsProperty method?

Copy link
Member

@LakshanF LakshanF left a comment

Choose a reason for hiding this comment

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

Thanks!

@jkotas jkotas merged commit 95c7952 into dotnet:main Aug 2, 2022
@tlakollo tlakollo deleted the AnnotateSystemNetLibraries branch August 2, 2022 16:51
Copy link

@terryryan1431 terryryan1431 left a comment

Choose a reason for hiding this comment

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

Let me know if it's ok

@ghost ghost locked as resolved and limited conversation to collaborators Sep 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants