-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
Refactor code in System.Net.HttpListener to be AOT safe Add annotations to System.Net.Http.Json to mark API as unsafe for AOT
Note regarding the 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. |
src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpContentJsonExtensions.cs
Outdated
Show resolved
Hide resolved
@@ -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>()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this 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
Refactor code in System.Net.HttpListener to be AOT safe
Add annotations to System.Net.Http.Json to mark API as unsafe for AOT