-
Notifications
You must be signed in to change notification settings - Fork 762
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 compatibility for all libraries #4871
Conversation
* Enable AOT compatibility for all libraries. Fix warnings. - Enable configuration binder source generator - The only library that can't use the ConfigBinder SG is the HeaderParsing library. - Blocked by dotnet/runtime#94547 * Fix Compliance Redaction. * Address PR feedback
For all libraries that use the Configuration.Binder source generator, explicitly reference the NuGet package. This ensures we get the latest version (8.0.1), which has all the source generator fixes.
This comment was marked as resolved.
This comment was marked as resolved.
...crosoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj
Outdated
Show resolved
Hide resolved
...es/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs
Show resolved
Hide resolved
@@ -8,6 +8,7 @@ | |||
|
|||
<PropertyGroup> | |||
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks> | |||
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator> |
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.
NIT: Does it hurt to set this property to true when a project is not referencing the configuration binder package? If not, then we might want to consider defaulting this to true in directory.build.props to avoid having to add it in most places. And to that same line, should we consider adding the generator by default to all projects too? I'm assuming libraries not using configuration will simply no-op for this generator (which may include a slight perf regresion in build time) but this may be beneficial for new libraries in the future.
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.
(Totally my opinion, I'm curious to hear others')
Since this source generator is off by default, I thought it would be better to continue to keep it off by default. It isn't really "most places". It is 12 libraries. By comparison, UseLoggingGenerator
is used in 13 libraries, and it isn't defaulted to be "on by default".
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.
Left minor comments, but looks good overall. Thanks Eric!
This is being addressed via #4870 |
...ries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
...oft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=523076&view=codecoverage-tab |
hrm... Looking at the reprot it is complaining about this line: extensions/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Metrics/CollectedMeasurement.cs Line 109 in 7db3a7e
Not sure why the changes in this PR are triggering it, but sounds like we should be able to just exclude from code coverage given that it looks like that is only for debugging purposes? |
I dug deeper and it is complaining about these 3 setters: Lines 58 to 82 in 7db3a7e
I looked at the |
I've traced down the code coverage issue to dotnet/runtime#96873. It looks like the only test we have in this area is Lines 31 to 40 in 7db3a7e
Which isn't setting these properties. I'll add to this test to ensure the properties get set so we can keep code coverage at 100%. |
- Change ArgumentNullException to normal ArgumentException - Add tests to LoggingRedactionOptions collection setters to keep 100% code coverage. dotnet/runtime#96873 causes these setters to no longer be called in the existing tests.
Port #4625 to
main
now that the Configuration.Binder bugs are fixed in 8.0.1.Enable AOT compatibility for all libraries and fix AOT warnings.
Explicitly reference
Microsoft.Extensions.Configuration.Binder
in projects that use the source generator to ensure we get the latest version (8.0.1).Microsoft Reviewers: Open in CodeFlow