Skip to content

Conversation

@live1206
Copy link
Member

Resolves #44127

The AOT warnings now running from https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp/test-aot-compat.ps1 are

ILC : Trim analysis warning IL2026: [Azure.Core]Azure.Core.Serialization.DynamicData: Using member 'Azure.Core.Serialization.DynamicData.DynamicDataJsonConverter.DynamicDataJsonConverter()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Using DynamicData or DynamicDataConverter is not compatible with trimming due to reflection-based serialization. [C:\src\azure-sdk-for-net\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj::TargetFramework=net7.0]
ILC : Trim analysis warning IL2026: [Azure.Core]Azure.Core.Json.MutableJsonDocument: Using member 'Azure.Core.Json.MutableJsonDocument.MutableJsonDocumentConverter.MutableJsonDocumentConverter()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Using MutableJsonDocument or MutableJsonDocumentConverter is not compatible with trimming due to reflection-based serialization. [C:\src\azure-sdk-for-net\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj::TargetFramework=net7.0]
ILC : AOT analysis warning IL3050: Microsoft.Extensions.DependencyInjection.ServiceLookup.IEnumerableCallSite.ServiceType.get: Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\src\azure-sdk-for-net\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj::TargetFramework=net7.0]
/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(2239): AOT analysis warning IL3050: System.Linq.Expressions.Expression.GetResultTypeOfShift(Type,Type): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\src\azure-sdk-for-net\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj::TargetFramework=net7.0]
/_/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs(28): AOT analysis warning IL3050: System.Dynamic.Utils.TypeUtils.GetNullableType(Type): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\src\azure-sdk-for-net\sdk\monitor\Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj::TargetFramework=net7.0]
Actual warning count is: 5

@live1206 live1206 requested a review from a team as a code owner May 23, 2024 03:20
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@jsquire jsquire requested review from eerhardt and m-redding May 24, 2024 14:14
Copy link
Member

@jsquire jsquire left a comment

Choose a reason for hiding this comment

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

Looks like we don't want to reconsider making members public at present and AOT issues are resolved by JsonDocument.Parse.

Copy link
Member

@m-redding m-redding left a comment

Choose a reason for hiding this comment

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

LGTM - the remaining BinaryData warnings are coming from System.Memory.Data - not this file

@annelo-msft
Copy link
Member

LGTM - the remaining BinaryData warnings are coming from System.Memory.Data - not this file

Would it make sense to look for an approach that doesn't require using the BinaryData APIs that trigger the warning?

@eerhardt
Copy link
Member

Would it make sense to look for an approach that doesn't require using the BinaryData APIs that trigger the warning?

The BinaryData APIs that don't trigger warnings take a JsonTypeInfo so it can serialize to/from JSON in a trim and AOT-compatible way. See dotnet/runtime#54979.

@live1206 live1206 merged commit 5605119 into Azure:main May 31, 2024
@live1206 live1206 deleted the aot-json-element branch May 31, 2024 00:30
benbp pushed a commit that referenced this pull request Jun 5, 2024
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.

[BUG] NextLinkOperationImplementation uses AOT incompatible BinaryData APIs

6 participants