diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index 442ad26d73a2..ca4974b06551 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -1,5 +1,7 @@ #nullable enable *REMOVED*Microsoft.AspNetCore.Components.ResourceAsset.ResourceAsset(string! url, System.Collections.Generic.IReadOnlyList? properties) -> void +*REMOVED*Microsoft.AspNetCore.Components.Routing.Router.PreferExactMatches.get -> bool +*REMOVED*Microsoft.AspNetCore.Components.Routing.Router.PreferExactMatches.set -> void Microsoft.AspNetCore.Components.ResourceAsset.ResourceAsset(string! url, System.Collections.Generic.IReadOnlyList? properties = null) -> void Microsoft.AspNetCore.Components.Routing.Router.NotFoundPage.get -> System.Type? Microsoft.AspNetCore.Components.Routing.Router.NotFoundPage.set -> void diff --git a/src/Components/Components/src/Routing/Router.cs b/src/Components/Components/src/Routing/Router.cs index fc18c528a95c..0dac5c05abca 100644 --- a/src/Components/Components/src/Routing/Router.cs +++ b/src/Components/Components/src/Routing/Router.cs @@ -98,14 +98,6 @@ static readonly IReadOnlyDictionary _emptyParametersDictionary /// [Parameter] public EventCallback OnNavigateAsync { get; set; } - /// - /// Gets or sets a flag to indicate whether route matching should prefer exact matches - /// over wildcards. - /// This property is obsolete and configuring it does nothing. - /// - [Obsolete("This property is obsolete and configuring it has no effect.")] - [Parameter] public bool PreferExactMatches { get; set; } - private RouteTable Routes { get; set; } /// diff --git a/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs b/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs index 559c2881127d..955e74b84d38 100644 --- a/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs +++ b/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs @@ -20,27 +20,6 @@ namespace Microsoft.AspNetCore.Components.Forms; /// public static partial class EditContextDataAnnotationsExtensions { - /// - /// Adds DataAnnotations validation support to the . - /// - /// The . - [Obsolete("Use " + nameof(EnableDataAnnotationsValidation) + " instead.")] - public static EditContext AddDataAnnotationsValidation(this EditContext editContext) - { - EnableDataAnnotationsValidation(editContext); - return editContext; - } - - /// - /// Enables DataAnnotations validation support for the . - /// - /// The . - /// A disposable object whose disposal will remove DataAnnotations validation support from the . - [Obsolete("This API is obsolete and may be removed in future versions. Use the overload that accepts an IServiceProvider instead.")] - public static IDisposable EnableDataAnnotationsValidation(this EditContext editContext) - { - return new DataAnnotationsEventSubscriptions(editContext, null!); - } /// /// Enables DataAnnotations validation support for the . /// diff --git a/src/Components/Forms/src/PublicAPI.Unshipped.txt b/src/Components/Forms/src/PublicAPI.Unshipped.txt index 7dc5c58110bf..8e50b300e33d 100644 --- a/src/Components/Forms/src/PublicAPI.Unshipped.txt +++ b/src/Components/Forms/src/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +*REMOVED*static Microsoft.AspNetCore.Components.Forms.EditContextDataAnnotationsExtensions.AddDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext! editContext) -> Microsoft.AspNetCore.Components.Forms.EditContext! +*REMOVED*static Microsoft.AspNetCore.Components.Forms.EditContextDataAnnotationsExtensions.EnableDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext! editContext) -> System.IDisposable! diff --git a/src/Components/Forms/test/EditContextDataAnnotationsExtensionsTest.cs b/src/Components/Forms/test/EditContextDataAnnotationsExtensionsTest.cs index 3ebd566d4f65..e58b5a736d6c 100644 --- a/src/Components/Forms/test/EditContextDataAnnotationsExtensionsTest.cs +++ b/src/Components/Forms/test/EditContextDataAnnotationsExtensionsTest.cs @@ -18,16 +18,6 @@ public void CannotUseNullEditContext() Assert.Equal("editContext", ex.ParamName); } - [Fact] - public void ObsoleteApiReturnsEditContextForChaining() - { - var editContext = new EditContext(new object()); -#pragma warning disable 0618 - var returnValue = editContext.AddDataAnnotationsValidation(); -#pragma warning restore 0618 - Assert.Same(editContext, returnValue); - } - [Fact] public void GetsValidationMessagesFromDataAnnotations() { diff --git a/src/Components/Web/src/Forms/InputFile/RemoteBrowserFileStreamOptions.cs b/src/Components/Web/src/Forms/InputFile/RemoteBrowserFileStreamOptions.cs deleted file mode 100644 index 4de7bab18c17..000000000000 --- a/src/Components/Web/src/Forms/InputFile/RemoteBrowserFileStreamOptions.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Runtime.Versioning; - -namespace Microsoft.AspNetCore.Components.Forms; - -/// -/// Repesents configurable options for with Blazor Server. -/// -[UnsupportedOSPlatform("browser")] -[Obsolete("RemoteJSDataStream defaults are utilized instead of the options here.")] -public class RemoteBrowserFileStreamOptions -{ - /// - /// Gets or sets the maximum segment size for file data sent over a SignalR circuit. - /// The default value is 20K. - /// - /// This only has an effect when using Blazor Server. - /// - /// - public int MaxSegmentSize { get; set; } = 20 * 1024; // SignalR limit is 32K. - - /// - /// Gets or sets the maximum internal buffer size for unread data sent over a SignalR circuit. - /// - /// This only has an effect when using Blazor Server. - /// - /// - public int MaxBufferSize { get; set; } = 1024 * 1024; - - /// - /// Gets or sets the time limit for fetching a segment of file data. - /// - /// This only has an effect when using Blazor Server. - /// - /// - public TimeSpan SegmentFetchTimeout { get; set; } = TimeSpan.FromMinutes(1); -} diff --git a/src/Components/Web/src/PublicAPI.Unshipped.txt b/src/Components/Web/src/PublicAPI.Unshipped.txt index 5b85eaf45fdc..5d049aae99a3 100644 --- a/src/Components/Web/src/PublicAPI.Unshipped.txt +++ b/src/Components/Web/src/PublicAPI.Unshipped.txt @@ -1,4 +1,34 @@ #nullable enable +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.MaxBufferSize.get -> int +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.MaxBufferSize.set -> void +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.MaxSegmentSize.get -> int +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.MaxSegmentSize.set -> void +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.RemoteBrowserFileStreamOptions() -> void +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.SegmentFetchTimeout.get -> System.TimeSpan +*REMOVED*Microsoft.AspNetCore.Components.Forms.RemoteBrowserFileStreamOptions.SegmentFetchTimeout.set -> void +*REMOVED*Microsoft.AspNetCore.Components.RenderTree.WebRenderer.RendererId.init -> void +*REMOVED*Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Action! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback +*REMOVED*static Microsoft.AspNetCore.Components.Web.WebEventCallbackFactoryEventArgsExtensions.Create(this Microsoft.AspNetCore.Components.EventCallbackFactory! factory, object! receiver, System.Func! callback) -> Microsoft.AspNetCore.Components.EventCallback Microsoft.AspNetCore.Components.Forms.InputHidden Microsoft.AspNetCore.Components.Forms.InputHidden.Element.get -> Microsoft.AspNetCore.Components.ElementReference? Microsoft.AspNetCore.Components.Forms.InputHidden.Element.set -> void diff --git a/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs b/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs deleted file mode 100644 index 4c34865354ea..000000000000 --- a/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.AspNetCore.Components.Web; - -/// -/// Provides extension methods for and types. -/// -public static class WebEventCallbackFactoryEventArgsExtensions -{ - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } - - /// - /// Creates an for the provided and - /// . - /// - /// The . - /// The event receiver. - /// The event callback. - /// The . - [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) - { - ArgumentNullException.ThrowIfNull(factory); - - return factory.Create(receiver, callback); - } -} diff --git a/src/Components/Web/src/WebRenderer.cs b/src/Components/Web/src/WebRenderer.cs index becd887453d0..fc83c3c360f6 100644 --- a/src/Components/Web/src/WebRenderer.cs +++ b/src/Components/Web/src/WebRenderer.cs @@ -52,9 +52,6 @@ public WebRenderer( protected int RendererId { get => _rendererId; - - [Obsolete($"The renderer ID can be assigned by overriding '{nameof(GetWebRendererId)}'.")] - init { /* No-op */ } } /// diff --git a/src/Components/WebAssembly/JSInterop/src/InternalCalls.cs b/src/Components/WebAssembly/JSInterop/src/InternalCalls.cs index 4ad543a146ce..680a1c67b087 100644 --- a/src/Components/WebAssembly/JSInterop/src/InternalCalls.cs +++ b/src/Components/WebAssembly/JSInterop/src/InternalCalls.cs @@ -1,22 +1,12 @@ // 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.Runtime.CompilerServices; using System.Runtime.InteropServices.JavaScript; namespace WebAssembly.JSInterop; internal static partial class InternalCalls { - // This method only exists for backwards compatibility and will be removed in the future. - // The exact namespace, type, and method name must match the corresponding entries - // in driver.c in the Mono distribution. - // See: https://github.com/mono/mono/blob/90574987940959fe386008a850982ea18236a533/sdks/wasm/src/driver.c#L318-L319 - [MethodImpl(MethodImplOptions.InternalCall)] - [Obsolete] - public static extern TRes InvokeJS(out string exception, ref JSCallInfo callInfo, [AllowNull] T0 arg0, [AllowNull] T1 arg1, [AllowNull] T2 arg2); - [JSImport("Blazor._internal.invokeJSJson", "blazor-internal")] public static partial string InvokeJSJson( string identifier, diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/PublicAPI.Unshipped.txt b/src/Components/WebAssembly/WebAssembly.Authentication/src/PublicAPI.Unshipped.txt index 7dc5c58110bf..dbe9cee9e3c9 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/PublicAPI.Unshipped.txt +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/PublicAPI.Unshipped.txt @@ -1 +1,8 @@ #nullable enable +*REMOVED*Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccessTokenResult.AccessTokenResult(Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccessTokenResultStatus status, Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccessToken! token, string! redirectUrl) -> void +*REMOVED*Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccessTokenResult.RedirectUrl.get -> string? +*REMOVED*Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService.RemoteAuthenticationService(Microsoft.JSInterop.IJSRuntime! jsRuntime, Microsoft.Extensions.Options.IOptionsSnapshot!>! options, Microsoft.AspNetCore.Components.NavigationManager! navigation, Microsoft.AspNetCore.Components.WebAssembly.Authentication.AccountClaimsPrincipalFactory! accountClaimsPrincipalFactory) -> void +*REMOVED*Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager +*REMOVED*Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager.SignOutSessionStateManager(Microsoft.JSInterop.IJSRuntime! jsRuntime) -> void +*REMOVED*virtual Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager.SetSignOutState() -> System.Threading.Tasks.ValueTask +*REMOVED*virtual Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager.ValidateSignOutState() -> System.Threading.Tasks.Task! diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/RemoteAuthenticatorViewCore.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/RemoteAuthenticatorViewCore.cs index 69c9b1e70c86..4f8a25cab707 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/RemoteAuthenticatorViewCore.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/RemoteAuthenticatorViewCore.cs @@ -106,10 +106,6 @@ public RemoteAuthenticationApplicationPathsOptions ApplicationPaths [Inject] internal AuthenticationStateProvider AuthenticationProvider { get; set; } = default!; -#pragma warning disable CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility - [Inject] internal SignOutSessionStateManager SignOutManager { get; set; } = default!; -#pragma warning restore CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility - [Inject] internal ILogger> Logger { get; set; } = default!; /// @@ -282,9 +278,7 @@ private async Task ProcessLogInCallback() private async Task ProcessLogOut(string returnUrl) { - if ((Navigation.HistoryEntryState != null && !ValidateSignOutRequestState()) || - // For backcompat purposes, keep SignOutManager working, even though we now use the history.state for this. - (Navigation.HistoryEntryState == null && !await SignOutManager.ValidateSignOutState())) + if (Navigation.HistoryEntryState == null || !ValidateSignOutRequestState()) { Log.LogoutOperationInitiatedExternally(Logger); Navigation.NavigateTo(ApplicationPaths.LogOutFailedPath, AuthenticationNavigationOptions with { HistoryEntryState = "The logout was not initiated from within the page." }); diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenNotAvailableException.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenNotAvailableException.cs index d1ce1b61e484..1c42d3d79423 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenNotAvailableException.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenNotAvailableException.cs @@ -41,9 +41,7 @@ public void Redirect() } else { -#pragma warning disable CS0618 // Type or member is obsolete - _navigation.NavigateTo(_tokenResult.RedirectUrl!); -#pragma warning restore CS0618 // Type or member is obsolete + _navigation.NavigateTo(_tokenResult.InteractiveRequestUrl!); } } diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenResult.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenResult.cs index 576b323509d9..3971b66eda16 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenResult.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/AccessTokenResult.cs @@ -12,20 +12,6 @@ public class AccessTokenResult { private readonly AccessToken _token; - /// - /// Initializes a new instance of . - /// - /// The status of the result. - /// The in case it was successful. - /// The redirect uri to go to for provisioning the token. - [Obsolete("Use the AccessTokenResult(AccessTokenResultStatus, AccessToken, string, InteractiveRequestOptions)")] - public AccessTokenResult(AccessTokenResultStatus status, AccessToken token, [StringSyntax(StringSyntaxAttribute.Uri)] string redirectUrl) - { - Status = status; - _token = token; - RedirectUrl = redirectUrl; - } - /// /// Initializes a new instance of . /// @@ -46,12 +32,6 @@ public AccessTokenResult(AccessTokenResultStatus status, AccessToken token, [Str /// public AccessTokenResultStatus Status { get; } - /// - /// Gets the URL to redirect to if is . - /// - [Obsolete("Use 'InteractiveRequestUrl' and 'InteractiveRequest' instead.")] - public string? RedirectUrl { get; } - /// /// Gets the URL to call if is /// . diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs index 12d315bdaf60..61e5d080e492 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/RemoteAuthenticationService.cs @@ -57,23 +57,6 @@ public class RemoteAuthenticationService< /// protected RemoteAuthenticationOptions Options { get; } - /// - /// Initializes a new instance. - /// - /// The to use for performing JavaScript interop operations. - /// The options to be passed down to the underlying JavaScript library handling the authentication operations. - /// The used to generate URLs. - /// The used to generate the for the user. - [Obsolete("Use the constructor RemoteAuthenticationService(IJSRuntime,IOptionsSnapshot>,NavigationManager,AccountClaimsPrincipalFactory,ILogger>) instead.")] - public RemoteAuthenticationService( - IJSRuntime jsRuntime, - IOptionsSnapshot> options, - NavigationManager navigation, - AccountClaimsPrincipalFactory accountClaimsPrincipalFactory) - : this(jsRuntime, options, navigation, accountClaimsPrincipalFactory, null) - { - } - /// /// Initializes a new instance. /// diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/SignOutSessionStateManager.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/SignOutSessionStateManager.cs deleted file mode 100644 index 74b61cb7aca2..000000000000 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Services/SignOutSessionStateManager.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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.Text.Json; -using Microsoft.JSInterop; -using static Microsoft.AspNetCore.Internal.LinkerFlags; - -namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication; - -/// -/// Handles CSRF protection for the logout endpoint. -/// -[Obsolete("Use 'Microsoft.AspNetCore.Components.Webassembly.Authentication.NavigationManagerExtensions.NavigateToLogout' instead.")] -public class SignOutSessionStateManager -{ - private readonly IJSRuntime _jsRuntime; - - /// - /// Initialize a new instance of . - /// - /// The . - public SignOutSessionStateManager(IJSRuntime jsRuntime) => _jsRuntime = jsRuntime; - - /// - /// Sets up some state in session storage to allow for logouts from within the page. - /// - /// A that completes when the state has been saved to session storage. - [DynamicDependency(JsonSerialized, typeof(SignOutState))] - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "The correct members will be preserved by the above DynamicDependency.")] - // This should use JSON source generation - public virtual ValueTask SetSignOutState() - { - return _jsRuntime.InvokeVoidAsync( - "sessionStorage.setItem", - "Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutState", - JsonSerializer.Serialize(SignOutState.Instance, JsonSerializerOptions.Web)); - } - - /// - /// Validates the existence of some state previously setup by in session storage to allow - /// logouts from within the page. - /// - /// A that completes when the state has been validated and indicates the validity of the state. - public virtual async Task ValidateSignOutState() - { - var state = await GetSignOutState(); - if (state.Local) - { - await ClearSignOutState(); - return true; - } - - return false; - } - - private async ValueTask GetSignOutState() - { - var result = await _jsRuntime.InvokeAsync( - "sessionStorage.getItem", - "Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutState"); - if (result == null) - { - return default; - } - - return DeserializeSignOutState(result); - } - - [DynamicDependency(JsonSerialized, typeof(SignOutState))] - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "The correct members will be preserved by the above DynamicDependency.")] - // This should use JSON source generation - private static SignOutState DeserializeSignOutState(string result) => JsonSerializer.Deserialize(result, JsonSerializerOptions.Web); - - private ValueTask ClearSignOutState() - { - return _jsRuntime.InvokeVoidAsync( - "sessionStorage.removeItem", - "Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutState"); - } - - private struct SignOutState - { - public static readonly SignOutState Instance = new SignOutState { Local = true }; - - public bool Local { get; set; } - } -} diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs b/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs index 20cf1e0867f7..ee43cde4379f 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs @@ -71,9 +71,6 @@ public static IRemoteAuthenticationBuilder services.TryAddScoped>(); services.TryAddScoped(); -#pragma warning disable CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility - services.TryAddScoped(); -#pragma warning restore CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility services.TryAddScoped>(); diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs index 694e3aea29f4..2f138f61a0d5 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs +++ b/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs @@ -370,37 +370,6 @@ public async Task AuthenticationManager_Logout_DoesNothingOnRedirect() } - [Fact] - public async Task AuthenticationManager_Logout_RedirectsToFailureOnInvalidSignOutState() - { - // Arrange - var (remoteAuthenticator, renderer, authServiceMock) = CreateAuthenticationManager( - "https://www.example.com/base/authentication/logout", - new InteractiveRequestOptions { Interaction = InteractionType.SignIn, ReturnUrl = "https://www.example.com/base/fetchData" }.ToState()); - - if (remoteAuthenticator.SignOutManager is TestSignOutSessionStateManager testManager) - { - testManager.SignOutState = false; - } - - var parameters = ParameterView.FromDictionary(new Dictionary - { - [_action] = RemoteAuthenticationActions.LogOut - }); - - // Act - await renderer.Dispatcher.InvokeAsync(() => remoteAuthenticator.SetParametersAsync(parameters)); - - // Assert - Assert.Equal( - "https://www.example.com/base/authentication/logout-failed", - remoteAuthenticator.Navigation.Uri); - - Assert.Equal( - "The logout was not initiated from within the page.", - ((TestNavigationManager)remoteAuthenticator.Navigation).HistoryEntryState); - } - [Fact] public async Task AuthenticationManager_Logout_NavigatesToLogoutFailureOnError() { @@ -731,8 +700,6 @@ private static Mock.Of>>(), navigationManager); - remoteAuthenticator.SignOutManager = new TestSignOutSessionStateManager(); - remoteAuthenticator.AuthenticationService = authenticationServiceMock; remoteAuthenticator.AuthenticationProvider = authenticationServiceMock; return (remoteAuthenticator, renderer, authenticationServiceMock); @@ -756,24 +723,6 @@ protected override void NavigateToCore(string uri, NavigationOptions options) } } -#pragma warning disable CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility - private class TestSignOutSessionStateManager : SignOutSessionStateManager -#pragma warning restore CS0618 // Type or member is obsolete, we keep it for now for backwards compatibility - { - public TestSignOutSessionStateManager() : base(null) - { - } - public bool SignOutState { get; set; } = true; - - public override ValueTask SetSignOutState() - { - SignOutState = true; - return default; - } - - public override Task ValidateSignOutState() => Task.FromResult(SignOutState); - } - private class TestJsRuntime : IJSRuntime { public (string identifier, object[] args) LastInvocation { get; set; } diff --git a/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs b/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs index 12849698a874..fffc8dd15a18 100644 --- a/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs +++ b/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs @@ -14,13 +14,6 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Infrastructure; [EditorBrowsable(EditorBrowsableState.Never)] public static class JSInteropMethods { - /// - /// For framework use only. - /// - [Obsolete("This API is for framework use only and is no longer used in the current version")] - public static void NotifyLocationChanged(string uri, bool isInterceptedLink) - => WebAssemblyNavigationManager.Instance.SetLocation(uri, null, isInterceptedLink); - /// /// For framework use only. /// diff --git a/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Unshipped.txt b/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Unshipped.txt index 7cfa4804d26b..0df7c51bc9b7 100644 --- a/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Unshipped.txt +++ b/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Unshipped.txt @@ -6,3 +6,5 @@ static Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilde *REMOVED*Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload *REMOVED*static Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.ApplyHotReloadDelta(string! moduleIdString, byte[]! metadataDelta, byte[]! ilDelta, byte[]! pdbBytes, int[]? updatedTypes) -> void *REMOVED*static Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.GetApplyUpdateCapabilities() -> string! +*REMOVED*~static Microsoft.AspNetCore.Components.WebAssembly.Infrastructure.JSInteropMethods.NotifyLocationChanged(string uri, bool isInterceptedLink) -> void +*REMOVED*static Microsoft.AspNetCore.Components.WebAssembly.Infrastructure.JSInteropMethods.NotifyLocationChanged(string! uri, bool isInterceptedLink) -> void