diff --git a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs
index d2a47e7c533c..43f989fdd13e 100644
--- a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs
+++ b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Endpoints;
using Microsoft.AspNetCore.Components.Infrastructure;
@@ -23,6 +24,7 @@ public static class RazorComponentsServiceCollectionExtensions
///
/// The service collection.
/// A builder for configuring the Razor Components endpoints.
+ [RequiresUnreferencedCode("Razor Components does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IRazorComponentsBuilder AddRazorComponents(this IServiceCollection services)
{
services.TryAddSingleton();
diff --git a/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs b/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs
index d8f7b78a306b..50ae59f6fe55 100644
--- a/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs
+++ b/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Routing;
@@ -27,6 +28,7 @@ public static class ComponentServiceCollectionExtensions
/// The .
/// A callback to configure .
/// An that can be used to further customize the configuration.
+ [RequiresUnreferencedCode("Server-side Blazor does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IServerSideBlazorBuilder AddServerSideBlazor(this IServiceCollection services, Action? configure = null)
{
var builder = new DefaultServerSideBlazorBuilder(services);
diff --git a/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs b/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs
index ee8c3d956981..107ef26f6fdd 100644
--- a/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs
+++ b/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs
@@ -21,6 +21,7 @@ public static class IdentityServiceCollectionExtensions
/// The type representing a Role in the system.
/// The services available in the application.
/// An for creating and configuring the identity system.
+ [RequiresUnreferencedCode("Identity middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IdentityBuilder AddIdentity(
this IServiceCollection services)
where TUser : class
@@ -35,6 +36,7 @@ public static class IdentityServiceCollectionExtensions
/// The services available in the application.
/// An action to configure the .
/// An for creating and configuring the identity system.
+ [RequiresUnreferencedCode("Identity middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IdentityBuilder AddIdentity(
this IServiceCollection services,
Action setupAction)
diff --git a/src/Middleware/Session/src/SessionServiceCollectionExtensions.cs b/src/Middleware/Session/src/SessionServiceCollectionExtensions.cs
index 314b1a624976..c6b6183faeb4 100644
--- a/src/Middleware/Session/src/SessionServiceCollectionExtensions.cs
+++ b/src/Middleware/Session/src/SessionServiceCollectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Session;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -17,6 +18,7 @@ public static class SessionServiceCollectionExtensions
///
/// The to add the services to.
/// The so that additional calls can be chained.
+ [RequiresUnreferencedCode("Session State middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IServiceCollection AddSession(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -32,6 +34,7 @@ public static IServiceCollection AddSession(this IServiceCollection services)
/// The to add the services to.
/// The session options to configure the middleware with.
/// The so that additional calls can be chained.
+ [RequiresUnreferencedCode("Session State middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IServiceCollection AddSession(this IServiceCollection services, Action configure)
{
ArgumentNullException.ThrowIfNull(services);
diff --git a/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs b/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
index 9537cdd8b7a3..3efedae7191a 100644
--- a/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
@@ -26,6 +27,7 @@ public static class MvcRazorPagesMvcCoreBuilderExtensions
///
/// The .
/// The .
+ [RequiresUnreferencedCode("Razor Pages does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcCoreBuilder AddRazorPages(this IMvcCoreBuilder builder)
{
ArgumentNullException.ThrowIfNull(builder);
diff --git a/src/Mvc/Mvc/src/MvcServiceCollectionExtensions.cs b/src/Mvc/Mvc/src/MvcServiceCollectionExtensions.cs
index cee62754969e..101ffef960d4 100644
--- a/src/Mvc/Mvc/src/MvcServiceCollectionExtensions.cs
+++ b/src/Mvc/Mvc/src/MvcServiceCollectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
@@ -76,6 +77,7 @@ public static IMvcBuilder AddMvc(this IServiceCollection services, Action
///
+ [RequiresUnreferencedCode("MVC does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddControllers(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -110,6 +112,7 @@ public static IMvcBuilder AddControllers(this IServiceCollection services)
/// on the resulting builder.
///
///
+ [RequiresUnreferencedCode("MVC does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddControllers(this IServiceCollection services, Action? configure)
{
ArgumentNullException.ThrowIfNull(services);
@@ -167,6 +170,7 @@ private static IMvcCoreBuilder AddControllersCore(IServiceCollection services)
/// To add services for pages call .
///
///
+ [RequiresUnreferencedCode("MVC does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddControllersWithViews(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -199,6 +203,7 @@ public static IMvcBuilder AddControllersWithViews(this IServiceCollection servic
/// To add services for pages call .
///
///
+ [RequiresUnreferencedCode("MVC does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddControllersWithViews(this IServiceCollection services, Action? configure)
{
ArgumentNullException.ThrowIfNull(services);
@@ -246,6 +251,7 @@ private static IMvcCoreBuilder AddControllersWithViewsCore(IServiceCollection se
/// To add services for controllers with views call .
///
///
+ [RequiresUnreferencedCode("Razor Pages does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddRazorPages(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -276,6 +282,7 @@ public static IMvcBuilder AddRazorPages(this IServiceCollection services)
/// To add services for controllers with views call .
///
///
+ [RequiresUnreferencedCode("Razor Pages does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static IMvcBuilder AddRazorPages(this IServiceCollection services, Action? configure)
{
ArgumentNullException.ThrowIfNull(services);
diff --git a/src/Security/Authentication/Core/src/AuthenticationServiceCollectionExtensions.cs b/src/Security/Authentication/Core/src/AuthenticationServiceCollectionExtensions.cs
index 15ff9cf841b6..708e3c217ae9 100644
--- a/src/Security/Authentication/Core/src/AuthenticationServiceCollectionExtensions.cs
+++ b/src/Security/Authentication/Core/src/AuthenticationServiceCollectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -16,6 +17,7 @@ public static class AuthenticationServiceCollectionExtensions
///
/// The .
/// A that can be used to further configure authentication.
+ [RequiresUnreferencedCode("Authentication middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -36,6 +38,7 @@ public static AuthenticationBuilder AddAuthentication(this IServiceCollection se
/// The .
/// The default scheme used as a fallback for all other schemes.
/// A that can be used to further configure authentication.
+ [RequiresUnreferencedCode("Authentication middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services, string defaultScheme)
=> services.AddAuthentication(o => o.DefaultScheme = defaultScheme);
@@ -45,6 +48,7 @@ public static AuthenticationBuilder AddAuthentication(this IServiceCollection se
/// The .
/// A delegate to configure .
/// A that can be used to further configure authentication.
+ [RequiresUnreferencedCode("Authentication middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services, Action configureOptions)
{
ArgumentNullException.ThrowIfNull(services);
diff --git a/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs b/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
index 9b2eded595d6..6f032f4a1edf 100644
--- a/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
+++ b/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -34,6 +35,7 @@ public static ISignalRServerBuilder AddHubOptions(this ISignalRServerBuild
///
/// The to add services to.
/// An that can be used to further configure the SignalR services.
+ [RequiresUnreferencedCode("SignalR does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static ISignalRServerBuilder AddSignalR(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
@@ -52,6 +54,7 @@ public static ISignalRServerBuilder AddSignalR(this IServiceCollection services)
/// The to add services to.
/// An to configure the provided .
/// An that can be used to further configure the SignalR services.
+ [RequiresUnreferencedCode("SignalR does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static ISignalRServerBuilder AddSignalR(this IServiceCollection services, Action configure)
{
ArgumentNullException.ThrowIfNull(services);