Skip to content

Commit

Permalink
First attempt to have better trimmability on .NET 8 (#2575)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmprieur authored Nov 7, 2023
1 parent 9778e82 commit 623cc3d
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.Identity.Web.DownstreamApi/DownstreamApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Task<HttpResponseMessage> CallApiForAppAsync(
}

/// <inheritdoc/>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.DownstreamApi.SerializeInput<TInput>(TInput, DownstreamApiOptions)")]
#endif
public async Task<TOutput?> CallApiForUserAsync<TInput, TOutput>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class MicrosoftGraphExtensions
/// <param name="builder">Builder.</param>
/// <param name="configurationSection">Configuration section.</param>
/// <returns>The builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public static MicrosoftIdentityAppCallsWebApiAuthenticationBuilder AddMicrosoftGraph(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class MicrosoftGraphExtensions
/// <param name="builder">Builder.</param>
/// <param name="configurationSection">Configuration section.</param>
/// <returns>The builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public static MicrosoftIdentityAppCallsWebApiAuthenticationBuilder AddMicrosoftGraph(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MicrosoftIdentityBaseAuthenticationBuilder
/// </summary>
/// <param name="services">The services being configured.</param>
/// <param name="configurationSection">Optional configuration section.</param>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
protected MicrosoftIdentityBaseAuthenticationBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected TokenAcquirerFactory()
/// [!code-csharp[ConvertType](~/../tests/DevApps/aspnet-mvc/OwinWebApp/App_Start/Startup.Auth.cs?highlight=22)]
/// ]]></format>
/// </example>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
static public T GetDefaultInstance<T>(string configSection="AzureAd") where T : TokenAcquirerFactory, new()
Expand Down Expand Up @@ -108,7 +108,7 @@ protected TokenAcquirerFactory()
/// [!code-csharp[ConvertType](~/../tests/DevApps/daemon-app/daemon-console-calling-msgraph/Program.cs?highlight=5)]
/// ]]></format>
/// </example>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
static public TokenAcquirerFactory GetDefaultInstance(string configSection = "AzureAd")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class WebApiBuilders
/// <param name="services">The services being configured.</param>
/// <param name="configuration">IConfigurationSection.</param>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Bind, Configure with Unspecified Configuration and ServiceCollection.")]
#endif
public static MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class DownstreamWebApiExtensions
[Obsolete("Use AddDownstreamApi in Microsoft.Identity.Abstractions, implemented in Microsoft.Identity.Web.DownstreamApi." +
"See aka.ms/id-web-downstream-api-v2 for migration details.", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOutput>(IServiceCollection, String, IConfiguration).")]
#endif
public static MicrosoftIdentityAppCallsWebApiAuthenticationBuilder AddDownstreamWebApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class MicrosoftIdentityAuthenticationMessageHandlerHttpClientBuild
/// <param name="serviceName">Name of the configuration for the service.</param>
/// <param name="configuration">Configuration.</param>
/// <returns>The builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOutput>(IServiceCollection, String, IConfiguration).")]
#endif
public static IHttpClientBuilder AddMicrosoftIdentityUserAuthenticationHandler(
Expand Down Expand Up @@ -65,7 +65,7 @@ public static IHttpClientBuilder AddMicrosoftIdentityUserAuthenticationHandler(
/// <param name="serviceName">Name of the configuration for the service.</param>
/// <param name="configuration">Configuration.</param>
/// <returns>The builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOutput>(IServiceCollection, String, IConfiguration).")]
#endif
public static IHttpClientBuilder AddMicrosoftIdentityAppAuthenticationHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MicrosoftIdentityWebApiAuthenticationBuilder : MicrosoftIdentityBas
/// the <see cref="MicrosoftIdentityOptions"/>Microsoft identity options.</param>
/// <param name="configurationSection">Configuration section from which to
/// get parameters.</param>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityBaseAuthenticationBuilder.MicrosoftIdentityBaseAuthenticationBuilder(IServiceCollection, IConfigurationSection).")]
#endif
internal MicrosoftIdentityWebApiAuthenticationBuilder(
Expand All @@ -53,7 +53,7 @@ internal MicrosoftIdentityWebApiAuthenticationBuilder(
/// </summary>
/// <param name="configureConfidentialClientApplicationOptions">The action to configure <see cref="ConfidentialClientApplicationOptions"/>.</param>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.Internal.WebApiBuilders.EnableTokenAcquisition(IServiceCollection, string, Action<ConfidentialClientApplicationOptions>, IConfigurationSection).")]
#endif
public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisitionToCallDownstreamApi(
Expand All @@ -72,7 +72,7 @@ public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisiti
ConfigurationSection);
}

#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.Internal.WebApiBuilders.EnableTokenAcquisition(Action<ConfidentialClientApplicationOptions>, String, IServiceCollection, IConfigurationSection).")]
#endif
internal static void CallsWebApiImplementation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class MicrosoftIdentityWebApiAuthenticationBuilderExtensions
/// Set to true if you want to debug, or just understand the JWT bearer events.
/// </param>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthneticationBuilderExtensions.AddMicrosoftIdentityWebApi(AuthenticationBuilder, IConfigurationSection, string, bool).")]
#endif
public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApi(
Expand Down Expand Up @@ -69,7 +69,7 @@ public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddM
/// Set to true if you want to debug, or just understand the JWT bearer events.
/// </param>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApi(
Expand Down Expand Up @@ -105,7 +105,7 @@ public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddM
/// <param name="subscribeToJwtBearerMiddlewareDiagnosticsEvents">
/// Set to true if you want to debug, or just understand the JWT bearer events.</param>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilder.MicrosoftIdentityWebApiAuthenticationBuilder(IServiceCollection, String, Action<JwtBearerOptions>, Action<MicrosoftIdentityOptions>, IConfigurationSection).")]
#endif
public static MicrosoftIdentityWebApiAuthenticationBuilder AddMicrosoftIdentityWebApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.Identity.Web
/// <summary>
/// Builder for web API authentication with configuration.
/// </summary>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilder.MicrosoftIdentityWebApiAuthenticationBuilder(IServiceCollection, String, Action<JwtBearerOptions>, Action<MicrosoftIdentityOptions>, IConfigurationSection).")]
#endif
public class MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration : MicrosoftIdentityWebApiAuthenticationBuilder
Expand All @@ -33,7 +33,7 @@ internal MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration(
/// This method expects the configuration file will have a section, named "AzureAd" as default, with the necessary settings to initialize authentication options.
/// </summary>
/// <returns>The authentication builder to chain.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisitionToCallDownstreamApi()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static partial class MicrosoftIdentityWebApiServiceCollectionExtensions
/// <param name="subscribeToJwtBearerMiddlewareDiagnosticsEvents">
/// Set to true if you want to debug, or just understand the JwtBearer events.</param>
/// <returns>The authentication builder to chain extension methods.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilderExtensions.AddMicrosoftIdentityWebApi(AuthenticationBuilder, IConfiguration, String, String, Boolean).")]
#endif
public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApiAuthentication(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MicrosoftIdentityWebAppAuthenticationBuilder : MicrosoftIdentityBas
/// <param name="configureMicrosoftIdentityOptions">Action called to configure
/// the <see cref="MicrosoftIdentityOptions"/>Microsoft identity options.</param>
/// <param name="configurationSection">Optional configuration section.</param>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityBaseAuthenticationBuilder.MicrosoftIdentityBaseAuthenticationBuilder(IServiceCollection, IConfigurationSection).")]
#endif
internal MicrosoftIdentityWebAppAuthenticationBuilder(
Expand All @@ -53,7 +53,7 @@ internal MicrosoftIdentityWebAppAuthenticationBuilder(
/// </summary>
/// <param name="initialScopes">Initial scopes.</param>
/// <returns>The builder itself for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityBaseAuthenticationBuilder.MicrosoftIdentityBaseAuthenticationBuilder(IServiceCollection, IConfigurationSection).")]
#endif
public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisitionToCallDownstreamApi(
Expand All @@ -70,7 +70,7 @@ public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisiti
/// MSAL.NET confidential client application options.</param>
/// <param name="initialScopes">Initial scopes.</param>
/// <returns>The builder itself for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilder.WebAppCallsWebApiImplementation(IServiceCollection, IEnumerable<string>, Action<MicrosoftIdentityOptions>, string, Action<ConfidentialClientApplicationOptions>.")]
#endif
public MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisitionToCallDownstreamApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration AddM
/// <param name="subscribeToOpenIdConnectMiddlewareDiagnosticsEvents">Set to true if you want to debug, or just understand the OpenID Connect events.</param>
/// <param name="displayName">A display name for the authentication handler.</param>
/// <returns>The authentication builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public static MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApp(
Expand Down Expand Up @@ -115,7 +115,7 @@ public static MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration AddM
/// <param name="subscribeToOpenIdConnectMiddlewareDiagnosticsEvents">Set to true if you want to debug, or just understand the OpenID Connect events.</param>
/// <param name="displayName">A display name for the authentication handler.</param>
/// <returns>The authentication builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderExtensions.AddMicrosoftWebAppWithoutConfiguration(AuthenticationBuilder, Action<MicrosoftIdentityOptions>, Action<CookieAuthenticationOptions>, String, String, Boolean, String).")]
#endif
public static MicrosoftIdentityWebAppAuthenticationBuilder AddMicrosoftIdentityWebApp(
Expand Down Expand Up @@ -150,7 +150,7 @@ public static MicrosoftIdentityWebAppAuthenticationBuilder AddMicrosoftIdentityW
/// <param name="displayName">A display name for the authentication handler.</param>
/// <param name="configurationSection">Configuration section.</param>
/// <returns>The authentication builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration.MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration(IServiceCollection, String, Action<MicrosoftIdentityOptions>, IConfigurationSection)")]
#endif
private static MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebAppWithConfiguration(
Expand Down Expand Up @@ -190,7 +190,7 @@ private static MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration Add
/// <param name="subscribeToOpenIdConnectMiddlewareDiagnosticsEvents">Set to true if you want to debug, or just understand the OpenID Connect events.</param>
/// <param name="displayName">A display name for the authentication handler.</param>
/// <returns>The authentication builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilder.MicrosoftIdentityWebAppAuthenticationBuilder(IServiceCollection, String, Action<MicrosoftIdentityOptions>, IConfigurationSection)")]
#endif
private static MicrosoftIdentityWebAppAuthenticationBuilder AddMicrosoftWebAppWithoutConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration : Mic
/// <param name="configureMicrosoftIdentityOptions">Action called to configure
/// the <see cref="MicrosoftIdentityOptions"/>Microsoft identity options.</param>
/// <param name="configurationSection">Optional configuration section.</param>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilder.MicrosoftIdentityWebAppAuthenticationBuilder(IServiceCollection, String, Action<MicrosoftIdentityOptions>, IConfigurationSection)")]
#endif
internal MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration(
Expand All @@ -41,7 +41,7 @@ internal MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration(
/// </summary>
/// <param name="initialScopes">Optional initial scopes to request.</param>
/// <returns>The authentication builder for chaining.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Calls Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration, Object).")]
#endif
public new MicrosoftIdentityAppCallsWebApiAuthenticationBuilder EnableTokenAcquisitionToCallDownstreamApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static partial class MicrosoftIdentityWebAppServiceCollectionExtensions
/// <param name="subscribeToOpenIdConnectMiddlewareDiagnosticsEvents">Set to true if you want to debug, or just understand the OpenIdConnect events.</param>
/// <param name="displayName">A display name for the authentication handler.</param>
/// <returns>The authentication builder to chain extension methods.</returns>
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER && !NET8_0_OR_GREATER
[RequiresUnreferencedCode("Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderExtensions.AddMicrosoftIdentityWebApp(AuthenticationBuilder, IConfiguration, String, String, String, Boolean, String).")]
#endif

Expand Down

0 comments on commit 623cc3d

Please sign in to comment.