Skip to content

Conversation

@vikukush
Copy link

@vikukush vikukush commented Mar 31, 2025

Cleanup microsoft-identity-web dependencies

Cleanup unnecessary PackageReferences and ProjectReferences from microsoft-identity-web

Description

Use ReferenceTrimmer to clean up unnecessary PackageReferences and ProjectReferences.

Four new AOT warnings excluded, caused by proper .NET SDK functions having these RequiresUnreferencedCodeAttribute and RequiresDynamicCodeAttribute attributes on them. This matches all the other warnings in this file.

D:\VSTS\microsoft-identity-web\src\Microsoft.Identity.Web.DownstreamApi\DownstreamApiExtensions.cs(33): Trim analysis warning IL2026: Microsoft.Identity.Web.DownstreamApiExtensions.AddDownstreamApi(IServiceCollection,String,IConfiguration): Using member 'Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<DownstreamApiOptions>(IServiceCollection,String,IConfiguration)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. TOptions's dependent types may have their members trimmed. Ensure all required members are preserved. [D:\VSTS\microsoft-identity-web\tests\Microsoft.Identity.Web.AotCompatibility.TestApp\Microsoft.Identity.Web.AotCompatibility.TestApp.csproj::TargetFramework=net8.0]
D:\VSTS\microsoft-identity-web\src\Microsoft.Identity.Web.DownstreamApi\DownstreamApiExtensions.cs(33): AOT analysis warning IL3050: Microsoft.Identity.Web.DownstreamApiExtensions.AddDownstreamApi(IServiceCollection,String,IConfiguration): Using member 'Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<DownstreamApiOptions>(IServiceCollection,String,IConfiguration)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Binding strongly typed objects to configuration values may require generating dynamic code at runtime. [D:\VSTS\microsoft-identity-web\tests\Microsoft.Identity.Web.AotCompatibility.TestApp\Microsoft.Identity.Web.AotCompatibility.TestApp.csproj::TargetFramework=net8.0]
D:\VSTS\microsoft-identity-web\src\Microsoft.Identity.Web.DownstreamApi\DownstreamApiExtensions.cs(73): Trim analysis warning IL2026: Microsoft.Identity.Web.DownstreamApiExtensions.AddDownstreamApis(IServiceCollection,IConfigurationSection): Using member 'Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration,Object)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Cannot statically analyze the type of instance so its members may be trimmed. [D:\VSTS\microsoft-identity-web\tests\Microsoft.Identity.Web.AotCompatibility.TestApp\Microsoft.Identity.Web.AotCompatibility.TestApp.csproj::TargetFramework=net8.0]
D:\VSTS\microsoft-identity-web\src\Microsoft.Identity.Web.DownstreamApi\DownstreamApiExtensions.cs(73): AOT analysis warning IL3050: Microsoft.Identity.Web.DownstreamApiExtensions.AddDownstreamApis(IServiceCollection,IConfigurationSection): Using member 'Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration,Object)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types. [D:\VSTS\microsoft-identity-web\tests\Microsoft.Identity.Web.AotCompatibility.TestApp\Microsoft.Identity.Web.AotCompatibility.TestApp.csproj::TargetFramework=net8.0]

@vikukush vikukush marked this pull request as ready for review March 31, 2025 19:15
@vikukush vikukush requested a review from a team as a code owner March 31, 2025 19:15
@vikukush
Copy link
Author

vikukush commented Apr 1, 2025

I tried enabling central package management for this repo, but there's just SO MUCH PACKAGE VERSION CONFLICTS, it's not really possible without bumping a lot of dependencies
Microsoft.IdentityModel.Tokens that you use globally as version 8.7.0 already depends on microsoft.extensions 6.0+ and that ruins all those 2.1.0 dependencies you've got there

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.

1 participant