-
Notifications
You must be signed in to change notification settings - Fork 218
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
Westinm/trimming #2210
Westinm/trimming #2210
Conversation
first pass over code to address trim warnings
src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiGenericExtensions.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiGenericExtensions.cs
Show resolved
Hide resolved
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.
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
I left a question
We can address it in a later iteration (with .NET 8). But would want to capture that in a work item.
@@ -93,7 +90,7 @@ public override void OnException(ExceptionContext context) | |||
IDWebErrorMessage.ScopeKeySectionIsProvidedButNotPresentInTheServicesCollection, | |||
nameof(ScopeKeySection))); | |||
} | |||
string? scopeKeySectionValue = configuration.GetValue<string>(ScopeKeySection); | |||
string? scopeKeySectionValue = configuration[ScopeKeySection]; |
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.
Can the section be a single property value? Did you test it?
@@ -22,6 +23,9 @@ public class MicrosoftIdentityBaseAuthenticationBuilder | |||
/// </summary> | |||
/// <param name="services">The services being configured.</param> | |||
/// <param name="configurationSection">Optional configuration section.</param> | |||
#if NET6_0_OR_GREATER | |||
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")] |
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.
Can we do better in .NET 8? by enabling EnableMicrosoftExtensionsConfigurationBinderSourceGenerator
?
https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#source-generator-for-configuration-binding
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.
From what I read, probably. I do want to try this and test it when we add .NET 8.
@@ -29,6 +29,10 @@ | |||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | |||
</PropertyGroup> | |||
|
|||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'"> | |||
<IsTrimmable>true</IsTrimmable> | |||
</PropertyGroup> |
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.
Do we also want to try
<EnableMicrosoftExtensionsConfigurationBinderSourceGenerator>true</EnableMicrosoftExtensionsConfigurationBinderSourceGenerator>
if we use Microsoft.Extensions.Configuration.Binder NuGet package 8.*?
and then remove the attributes which are due to the binding.
Shall we do that when we enable .NET 8?
@jennyf19 @westin-m ?
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's do that as an increment.
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.
Yes, I want to try this with .NET 8.
Make IdWeb trimmable. Where possible, change implementations to be trim-friendly. Otherwise, bubble-up the warnings to Apps calling our library. More info on trimming is here.
Published File Size in KB Using the 4-1-MyOrg Sample (.net7)