-
Notifications
You must be signed in to change notification settings - Fork 283
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
Suppress AOT analyzer warning in Redis instrumentation #1625
Conversation
The AOT analyzer warns about AOT incompatible code inside of a runtime check for RuntimeFeature.IsDynamicCodeSupported. See dotnet/linker#2715. Suppress this warning until the AOT analyzer is fixed. Although this repo doesn't have the AOT analyzer enabled yet, this code can be copied into other repos that do enable the analyzer - ex. dotnet/aspire. Porting this change into the otel source to make taking future updates easier. It will also be useful once this repo targets .NET 8 and enables the AOT analyzer.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1625 +/- ##
==========================================
- Coverage 73.91% 71.00% -2.92%
==========================================
Files 267 5 -262
Lines 9615 269 -9346
==========================================
- Hits 7107 191 -6916
+ Misses 2508 78 -2430
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Hi @eerhardt, it seems this project is already included as one of the TrimmerRootAssembly for the AOT TestApp. |
The difference comes because of the 2 different analysis tools: https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/#analyzing-net-libraries. The case where this matters is the "Roslyn Analyzers" case, which has the bug I linked above (See dotnet/linker#2715). The Roslyn Analyzers don't understand/respect the The AotCompatibility.TestApp uses the 2nd approach in that article: "Publishing a test application for AOT", which DOES understand/respect the So the scenario where this matters is when the Roslyn Analyzers are used on this code. This isn't the case in this repo, but this code is being copied to other repos ex. dotnet/aspire, which the Roslyn Analyzers are being used. Porting this change into the otel source to make taking future updates easier. It will also be useful once this repo targets .NET 8 and enables the AOT analyzer. |
Would it be possible to suppress the warnings in the repos which use Roslyn Analyzers and also consumes OpenTelemetry.Instrumentation.StackExchangeRedis until the bug is fixed? |
Yes. We are changing the "vendored"/"copied" code in the dotnet/aspire repo. See https://github.com/dotnet/aspire/pull/3104/files#diff-d4c41f6b9838aef61efa0008d9d139a76456adbbf35db653936dc21441427511R210. This PR is porting this change back to the "main" copy of this code so it is easier to keep the copies in sync. |
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.
LGTM
The AOT analyzer warns about AOT incompatible code inside of a runtime check for RuntimeFeature.IsDynamicCodeSupported. See dotnet/linker#2715.
Suppress this warning until the AOT analyzer is fixed.
Although this repo doesn't have the AOT analyzer enabled yet, this code can be copied into other repos that do enable the analyzer - ex. dotnet/aspire. Porting this change into the otel source to make taking future updates easier. It will also be useful once this repo targets .NET 8 and enables the AOT analyzer.
@sebastienros @reyang @CodeBlanch @utpilla