Skip to content

.NET Native AOT warnings from System.Net.Http #78367

Closed
@JamesNK

Description

@JamesNK

Description

Publishing an app with .NET Native AOT results in analysis warnings. Devs have confidence that their app works when no errors remain, so System.Net.Http shouldn't report warnings unless an AOT incompatible API is used from the assembly.

Reproduction Steps

  1. Create a console app
  2. Write code to create an HTTP request with HttpClient
  3. Publish with <PublishAot>true</PublishAot>

Expected behavior

No warning from System.Net.Http.

Actual behavior

I think it might be one error. I enabled this setting to get details: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-7-0#show-detailed-warnings

/_/src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs(333): AOT analysis warning IL3050: System.Net.Http.DiagnosticsHandler.Write<T>(DiagnosticSource,St
ring,!!0): Using member 'System.Diagnostics.DiagnosticSource.Write(String,Object)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Diagn
osticSource may require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling. [C:\Development\Source\grpc-dot
net\examples\Transcoder\Server\Server.csproj]

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions