Skip to content

Westinm/trimming - #2210

Merged
Westin Musser (westin-m) merged 16 commits into
masterfrom
westinm/trimming
May 13, 2023
Merged

Westin Musser (westin-m) merged 16 commits into
masterfrom
westinm/trimming

Conversation

@westin-m

@westin-m Westin Musser (westin-m) commented Apr 26, 2023 •

Copy link
Copy Markdown
Contributor

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)

Filename Before After % Change
Microsoft.Identity.Web.Certificate.dll 28 22 21%
Microsoft.Identity.Web.Certificateless.dll 12 12 0%
Microsoft.Identity.Web.Diagnostics.dll 13.5 9 33%
Microsoft.Identity.Web.dll 149 149 0%
Microsoft.Identity.Web.DownstreamApi.dll 53.5 53.5 0%
Microsoft.Identity.Web.TokenAcquisition.dll 122 88.5 27%
Microsoft.Identity.Web.TokenCache.dll 46 18.5 60%
Microsoft.Identity.Web.UI.dll 15 15 0%
Microsoft.Identity.Web.UI.Views.dll 17.5 17.5 0%

Comment thread Directory.Build.props Resolved
Comment thread Directory.Build.props Resolved

@jennyf19 jennyf19 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:shipit:

Copy link
Copy Markdown
Collaborator

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.

nameof(ScopeKeySection)));
}
string? scopeKeySectionValue = configuration.GetValue<string>(ScopeKeySection);
string? scopeKeySectionValue = configuration[ScopeKeySection];

Copy link
Copy Markdown
Collaborator

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?

/// <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).")]

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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.

Comment thread Directory.Build.props

<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

Copy link
Copy Markdown
Collaborator

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 Musser (@westin-m) ?

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.Identity.Web failing to validate audience with PublishTrimmed=true

4 participants