API docs for Components (#26505)

* Turn on doc warnings

* Api ref stuff

* Add api docs

* Api docs

* Missing docs

* Add docs

* Update src/Components/WebAssembly/WebAssembly.Authentication/src/Services/ExpiredTokenException.cs

Co-authored-by: Pranav K <prkrishn@hotmail.com>

Co-authored-by: Pranav K <prkrishn@hotmail.com>
This commit is contained in:
Hao Kung 2020-10-02 13:22:14 -07:00 committed by GitHub
parent e755f6017c
commit 0a52bb721c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 88 additions and 6 deletions

View File

@ -6,6 +6,7 @@
<NoPackageAnalysis>true</NoPackageAnalysis> <NoPackageAnalysis>true</NoPackageAnalysis>
<GenerateDocumentationFile>false</GenerateDocumentationFile> <GenerateDocumentationFile>false</GenerateDocumentationFile>
<Description>Roslyn analyzers for ASP.NET Core Components.</Description> <Description>Roslyn analyzers for ASP.NET Core Components.</Description>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -30,6 +30,9 @@ namespace Microsoft.AspNetCore.Components.Authorization
private readonly RenderFragment<AuthenticationState> _renderNotAuthorizedDelegate; private readonly RenderFragment<AuthenticationState> _renderNotAuthorizedDelegate;
private readonly RenderFragment _renderAuthorizingDelegate; private readonly RenderFragment _renderAuthorizingDelegate;
/// <summary>
/// Initialize a new instance of a <see cref="AuthorizeRouteView"/>.
/// </summary>
public AuthorizeRouteView() public AuthorizeRouteView()
{ {
// Cache the rendering delegates so that we only construct new closure instances // Cache the rendering delegates so that we only construct new closure instances

View File

@ -5,6 +5,7 @@
<IsAspNetCoreApp>true</IsAspNetCoreApp> <IsAspNetCoreApp>true</IsAspNetCoreApp>
<Description>Authentication and authorization support for Blazor applications.</Description> <Description>Authentication and authorization support for Blazor applications.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,6 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAspNetCoreApp>true</IsAspNetCoreApp> <IsAspNetCoreApp>true</IsAspNetCoreApp>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -35,6 +35,9 @@ namespace Microsoft.AspNetCore.Components
[Parameter] [Parameter]
public Type DefaultLayout { get; set; } public Type DefaultLayout { get; set; }
/// <summary>
/// Initializes a new instance of <see cref="RouteView"/>.
/// </summary>
public RouteView() public RouteView()
{ {
// Cache the delegate instances // Cache the delegate instances

View File

@ -17,8 +17,14 @@ namespace Microsoft.AspNetCore.Components.Routing
CancellationToken = cancellationToken; CancellationToken = cancellationToken;
} }
/// <summary>
/// The target path for the navigation.
/// </summary>
public string Path { get; } public string Path { get; }
/// <summary>
/// The <see cref="CancellationToken"/> to use to cancel navigation.
/// </summary>
public CancellationToken CancellationToken { get; } public CancellationToken CancellationToken { get; }
} }
} }

View File

@ -6,6 +6,7 @@
<Description>Forms and validation support for Blazor applications.</Description> <Description>Forms and validation support for Blazor applications.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,7 +6,7 @@
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> <GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>CS0436;$(NoWarn)</NoWarn> <NoWarn>CS0436;$(NoWarn.Replace('1591', ''))</NoWarn>
<DefineConstants>$(DefineConstants);ENABLE_UNSAFE_MSGPACK;SPAN_BUILTIN;MESSAGEPACK_INTERNAL;COMPONENTS_SERVER</DefineConstants> <DefineConstants>$(DefineConstants);ENABLE_UNSAFE_MSGPACK;SPAN_BUILTIN;MESSAGEPACK_INTERNAL;COMPONENTS_SERVER</DefineConstants>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<EmbeddedFilesManifestFileName>Microsoft.Extensions.FileProviders.Embedded.Manifest.xml</EmbeddedFilesManifestFileName> <EmbeddedFilesManifestFileName>Microsoft.Extensions.FileProviders.Embedded.Manifest.xml</EmbeddedFilesManifestFileName>

View File

@ -7,6 +7,9 @@ using Microsoft.JSInterop;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary>
/// Static class that adds extension methods to <see cref="ElementReference"/>.
/// </summary>
public static class ElementReferenceExtensions public static class ElementReferenceExtensions
{ {
/// <summary> /// <summary>

View File

@ -287,6 +287,7 @@ namespace Microsoft.AspNetCore.Components.Forms
return newDictionaryCreated; return newDictionaryCreated;
} }
/// <inheritdoc/>
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
} }

View File

@ -41,11 +41,13 @@ namespace Microsoft.AspNetCore.Components.Forms
[Parameter(CaptureUnmatchedValues = true)] [Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string, object>? AdditionalAttributes { get; set; } public IDictionary<string, object>? AdditionalAttributes { get; set; }
/// <inheritdoc/>
protected override void OnInitialized() protected override void OnInitialized()
{ {
_jsUnmarshalledRuntime = JSRuntime as IJSUnmarshalledRuntime; _jsUnmarshalledRuntime = JSRuntime as IJSUnmarshalledRuntime;
} }
/// <inheritdoc/>
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
if (firstRender) if (firstRender)
@ -55,6 +57,7 @@ namespace Microsoft.AspNetCore.Components.Forms
} }
} }
/// <inheritdoc/>
protected override void BuildRenderTree(RenderTreeBuilder builder) protected override void BuildRenderTree(RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "input"); builder.OpenElement(0, "input");

View File

@ -80,6 +80,10 @@ namespace Microsoft.AspNetCore.Components.Forms
} }
} }
/// <summary>
/// Called to dispose this instance.
/// </summary>
/// <param name="disposing"><see langword="true"/> if called within <see cref="IDisposable.Dispose"/>.</param>
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
} }

View File

@ -92,6 +92,7 @@ namespace Microsoft.AspNetCore.Components.Forms
} }
} }
/// <inheritdoc/>
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
} }

View File

@ -7,6 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>Microsoft.AspNetCore.Components</RootNamespace> <RootNamespace>Microsoft.AspNetCore.Components</RootNamespace>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -157,6 +157,7 @@ namespace Microsoft.AspNetCore.Components.Routing
return false; return false;
} }
/// <inheritdoc/>
protected override void BuildRenderTree(RenderTreeBuilder builder) protected override void BuildRenderTree(RenderTreeBuilder builder)
{ {
builder.OpenElement(0, "a"); builder.OpenElement(0, "a");

View File

@ -6,10 +6,17 @@ using Microsoft.JSInterop;
namespace Microsoft.AspNetCore.Components namespace Microsoft.AspNetCore.Components
{ {
/// <summary>
/// A <see cref="ElementReferenceContext"/> for a web element.
/// </summary>
public class WebElementReferenceContext : ElementReferenceContext public class WebElementReferenceContext : ElementReferenceContext
{ {
internal IJSRuntime JSRuntime { get; } internal IJSRuntime JSRuntime { get; }
/// <summary>
/// Initialize a new instance of <see cref="WebElementReferenceContext"/>.
/// </summary>
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
public WebElementReferenceContext(IJSRuntime jsRuntime) public WebElementReferenceContext(IJSRuntime jsRuntime)
{ {
JSRuntime = jsRuntime ?? throw new ArgumentNullException(nameof(jsRuntime)); JSRuntime = jsRuntime ?? throw new ArgumentNullException(nameof(jsRuntime));

View File

@ -6,6 +6,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<Description>Authenticate your Blazor webassembly applications with Azure Active Directory and Azure Active Directory B2C</Description> <Description>Authenticate your Blazor webassembly applications with Azure Active Directory and Azure Active Directory B2C</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -9,6 +9,7 @@
<StartupObject>Microsoft.AspNetCore.Components.WebAssembly.DevServer.Program</StartupObject> <StartupObject>Microsoft.AspNetCore.Components.WebAssembly.DevServer.Program</StartupObject>
<Description>Development server for use when building Blazor applications.</Description> <Description>Development server for use when building Blazor applications.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
<!-- Set this to false because assemblies should not reference this assembly directly, (except for tests, of course). --> <!-- Set this to false because assemblies should not reference this assembly directly, (except for tests, of course). -->
<IsProjectReferenceProvider>false</IsProjectReferenceProvider> <IsProjectReferenceProvider>false</IsProjectReferenceProvider>

View File

@ -6,6 +6,7 @@
<PackageTags>wasm;javascript;interop</PackageTags> <PackageTags>wasm;javascript;interop</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage> <IsShippingPackage>true</IsShippingPackage>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -48,6 +48,7 @@ namespace Microsoft.JSInterop.WebAssembly
InternalCalls.InvokeJS<object, object, object, string>(out _, ref callInfo, null, null, null); InternalCalls.InvokeJS<object, object, object, string>(out _, ref callInfo, null, null, null);
} }
/// <inheritdoc />
protected override void EndInvokeDotNet(DotNetInvocationInfo callInfo, in DotNetInvocationResult dispatchResult) protected override void EndInvokeDotNet(DotNetInvocationInfo callInfo, in DotNetInvocationResult dispatchResult)
{ {
// For failures, the common case is to call EndInvokeDotNet with the Exception object. // For failures, the common case is to call EndInvokeDotNet with the Exception object.

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Description>MSBuild support for building Blazor WebAssembly apps.</Description> <Description>MSBuild support for building Blazor WebAssembly apps.</Description>
<TargetFrameworks>$(DefaultNetCoreTargetFramework);net46</TargetFrameworks> <TargetFrameworks>$(DefaultNetCoreTargetFramework);net46</TargetFrameworks>
@ -9,7 +9,7 @@
<SdkOutputPath>$(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly\$(Configuration)\sdk-output\</SdkOutputPath> <SdkOutputPath>$(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly\$(Configuration)\sdk-output\</SdkOutputPath>
<!-- Allow assemblies outside of lib in the package --> <!-- Allow assemblies outside of lib in the package -->
<NoWarn>$(NoWarn);NU5100</NoWarn> <NoWarn>$(NoWarn.Replace('1591', ''));NU5100</NoWarn>
<!-- Need to build this project in source build --> <!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>

View File

@ -6,7 +6,7 @@
<IsShippingPackage>true</IsShippingPackage> <IsShippingPackage>true</IsShippingPackage>
<!-- We're deliberately bundling assemblies as content files. Suppress the warning. --> <!-- We're deliberately bundling assemblies as content files. Suppress the warning. -->
<NoWarn>$(NoWarn);NU5100</NoWarn> <NoWarn>$(NoWarn.Replace('1591', ''));NU5100</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>

View File

@ -14,6 +14,9 @@ using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Components.WebAssembly.Server namespace Microsoft.AspNetCore.Components.WebAssembly.Server
{ {
/// <summary>
/// Class for the target picker ui.
/// </summary>
public class TargetPickerUi public class TargetPickerUi
{ {
private static readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions private static readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions
@ -26,12 +29,22 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Server
private string _browserHost; private string _browserHost;
private string _debugProxyUrl; private string _debugProxyUrl;
/// <summary>
/// Initialize a new instance of <see cref="TargetPickerUi"/>.
/// </summary>
/// <param name="debugProxyUrl">The debug proxy url.</param>
/// <param name="devToolsHost">The dev tools host.</param>
public TargetPickerUi(string debugProxyUrl, string devToolsHost) public TargetPickerUi(string debugProxyUrl, string devToolsHost)
{ {
_debugProxyUrl = debugProxyUrl; _debugProxyUrl = debugProxyUrl;
_browserHost = devToolsHost; _browserHost = devToolsHost;
} }
/// <summary>
/// Display the ui.
/// </summary>
/// <param name="context">The <see cref="HttpContext"/>.</param>
/// <returns>The <see cref="Task"/>.</returns>
public async Task Display(HttpContext context) public async Task Display(HttpContext context)
{ {
context.Response.ContentType = "text/html"; context.Response.ContentType = "text/html";

View File

@ -14,6 +14,9 @@ namespace Microsoft.Extensions.DependencyInjection
where TRemoteAuthenticationState : RemoteAuthenticationState where TRemoteAuthenticationState : RemoteAuthenticationState
where TAccount : RemoteUserAccount where TAccount : RemoteUserAccount
{ {
/// <summary>
/// The <see cref="IServiceCollection"/>.
/// </summary>
IServiceCollection Services { get; } IServiceCollection Services { get; }
} }
} }

View File

@ -7,6 +7,7 @@
<Description>Build client-side authentication for single-page applications (SPAs).</Description> <Description>Build client-side authentication for single-page applications (SPAs).</Description>
<IsShippingPackage>true</IsShippingPackage> <IsShippingPackage>true</IsShippingPackage>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -17,6 +17,10 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication
private readonly IAccessTokenProviderAccessor _accessor; private readonly IAccessTokenProviderAccessor _accessor;
#pragma warning disable PUB0001 // Pubternal type in public API #pragma warning disable PUB0001 // Pubternal type in public API
/// <summary>
/// Initialize a new instance of <see cref="AccountClaimsPrincipalFactory{TAccount}"/>.
/// </summary>
/// <param name="accessor"></param>
public AccountClaimsPrincipalFactory(IAccessTokenProviderAccessor accessor) => _accessor = accessor; public AccountClaimsPrincipalFactory(IAccessTokenProviderAccessor accessor) => _accessor = accessor;
/// <summary> /// <summary>

View File

@ -17,6 +17,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication
private readonly NavigationManager _navigation; private readonly NavigationManager _navigation;
private readonly AccessTokenResult _tokenResult; private readonly AccessTokenResult _tokenResult;
/// <summary>
/// Initialize a new instance of <see cref="AccessTokenNotAvailableException"/>.
/// </summary>
/// <param name="navigation">The <see cref="NavigationManager"/>.</param>
/// <param name="tokenResult">The <see cref="AccessTokenResult"/>.</param>
/// <param name="scopes">The scopes.</param>
public AccessTokenNotAvailableException( public AccessTokenNotAvailableException(
NavigationManager navigation, NavigationManager navigation,
AccessTokenResult tokenResult, AccessTokenResult tokenResult,
@ -28,6 +34,9 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication
_navigation = navigation; _navigation = navigation;
} }
/// <summary>
/// Navigates to <see cref="AccessTokenResult.RedirectUrl"/> to allow refreshing the access token.
/// </summary>
public void Redirect() => _navigation.NavigateTo(_tokenResult.RedirectUrl); public void Redirect() => _navigation.NavigateTo(_tokenResult.RedirectUrl);
} }
} }

View File

@ -19,6 +19,10 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication
PropertyNameCaseInsensitive = true, PropertyNameCaseInsensitive = true,
}; };
/// <summary>
/// Initialize a new instance of <see cref="SignOutSessionStateManager"/>.
/// </summary>
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
public SignOutSessionStateManager(IJSRuntime jsRuntime) => _jsRuntime = jsRuntime; public SignOutSessionStateManager(IJSRuntime jsRuntime) => _jsRuntime = jsRuntime;
/// <summary> /// <summary>

View File

@ -4,6 +4,9 @@ using System.Text;
namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting
{ {
/// <summary>
/// Static class that adds extension methods to <see cref="IWebAssemblyHostEnvironment"/>.
/// </summary>
public static class WebAssemblyHostEnvironmentExtensions public static class WebAssemblyHostEnvironmentExtensions
{ {
/// <summary> /// <summary>

View File

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<Description>Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.</Description> <Description>Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.</Description>
<IsShippingPackage>true</IsShippingPackage> <IsShippingPackage>true</IsShippingPackage>
<NoWarn>$(NoWarn);BL0006</NoWarn> <NoWarn>$(NoWarn.Replace('1591', ''));BL0006</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>

View File

@ -28,6 +28,10 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Services
private readonly IJSRuntime _jsRuntime; private readonly IJSRuntime _jsRuntime;
private readonly HashSet<string> _loadedAssemblyCache; private readonly HashSet<string> _loadedAssemblyCache;
/// <summary>
/// Initializes a new instance of <see cref="LazyAssemblyLoader"/>.
/// </summary>
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
public LazyAssemblyLoader(IJSRuntime jsRuntime) public LazyAssemblyLoader(IJSRuntime jsRuntime)
{ {
_jsRuntime = jsRuntime; _jsRuntime = jsRuntime;