Skip to content

Conversation

@westin-m
Copy link
Contributor

@westin-m westin-m commented Apr 26, 2023

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%

@westin-m westin-m marked this pull request as ready for review May 12, 2023 18:34
@westin-m westin-m requested review from jennyf19 and jmprieur May 12, 2023 21:53
Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Collaborator

@jmprieur jmprieur left a 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.

nameof(ScopeKeySection)));
}
string? scopeKeySectionValue = configuration.GetValue<string>(ScopeKeySection);
string? scopeKeySectionValue = configuration[ScopeKeySection];
Copy link
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
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
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.


<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
Copy link
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-m ?

Copy link
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
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.

This was referenced Oct 6, 2025
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

5 participants