Skip to content

Commit 9402bfa

Browse files
dotnet-maestro-bothalter73dotnet-maestro[bot]SteveSandersonMScaptainsafia
authored
[automated] Merge branch 'release/8.0' => 'main' (#50281)
* Remove reflection from KestrelServer constructor (#50272) * Update dependencies from https://github.com/dotnet/extensions build 20230822.1 (#50288) [release/8.0] Update dependencies from dotnet/extensions * Ensure enhanced nav requests have the correct headers (#50263) * In SSR, supply HttpContext as cascading value (#50253) Fixes #48769 ### Usage ```cs [CascadingParameter] public HttpContext? Context { get; set; } ``` In SSR, this will receive the `HttpContext`. In other rendering modes where there is no HTTP context, no value will be supplied so the property will remain `null`. ### Alternative design considered In #48769 I suggested using `[SupplyParameterFromHttpContext]` but that turns out not to be practical unless we either (a) make `ICascadingValueSupplier` public, or (b) add an IVT from `M.A.Components` to `.Endpoints`. I'm not keen on doing either of the above on a whim. Plus, use of `[CascadingValue]` has advantages: * It's consistent with the existing pattern for authentication state (we have `[CascadingParameter] Task<AuthenticationState> AuthenticationStateTask { get; set; }`). * Longer term, if we add more things like this, it would be nice not to add a separate special attribute for each one when `[CascadingParameter]` is already descriptive enough. Special attributes are needed only when the type of thing being supplied might reasonably clash with something else the application is doing (for example, we do need it for form/query, as they supply arbitrary types). ## Review notes It's best to look at the two commits in this PR completely separately: 1. The first commit fixes an API design problem I discovered while considering how to do this. I realised that when we added `CascadingParameterAttributeBase`, we made a design mistake: * We put the `Name` property on the abstract base class just because `CascadingParameterAttribute`, `SupplyParameterFromQuery`, and `SupplyParameterFromForm` all have a `Name`. * However, in all three cases there, the `Name` has completely different meanings. For `CascadingParameterAttribute`, it's the name associated with `<CascadingValue Name=...>`, whereas for form it's the `Request.Form` entry or fall back on property name, and for query it's the `Request.Query` entry or fall back on property name. In general there's no reason why a `CascadingParameterAttributeBase` subclass should have a `Name` at all (`SupplyParameterFromHttpContext` wasn't going to), and if it does have one, its semantics are specific to it. So these should not be the same properties. * The change we made to make `CascadingParameterAttribute.Name` virtual might even be breaking (see https://learn.microsoft.com/en-us/dotnet/core/compatibility/library-change-rules stating *DISALLOWED: Adding the virtual keyword to a member*). So it's good we can revert that here. 2. The second commit is the completely trivial implementation of supplying `HttpContext` as a cascading value, with an E2E test. * Fix SSR redirections. Fixes #49670 (#50261) Fixes #49670 trivially by making `HttpNavigationManager`'s redirection logic consistent with the other `NavigationManager` implementations. You'll be wondering why there are no E2E tests with this PR. The reason is that, surprisingly, we *already* have E2E tests for these kinds of non-root redirections. However, they were falsely passing, which is tracked by #50260 and is outside the scope of this PR. I think we should address that other issue in .NET 9 as there should be no developer/API impact from leaving it as-is for .NET 8. * API review followups (#50181) * RazorComponentResult: change namespace, make executor internal, merge test classes * RazorComponentResult: Nullability and trim annotations * RazorComponentResult: IStatusCodeHttpResult and IContentTypeHttpResult * Cleanup * Further clean up annotations * Remove HtmlRootComponent.ComponentId as per API review * Rename SupplyParameterFromFormAttribute.Handler to FormName * API review: seal * Clarify RenderModeAttribute inheritance. Fixes #49848 * Rename valueFactory -> initialValueFactory * Remove unnecessary sequence params * Make [StreamRendering] default to true * Support hot reload for Blazor component endpoints (#50031) * Support hot reload for Blazor component endpoints * Use alternative navigation exports * Address feedback * Make HotReloadService optional * Address more feedback * [release/8.0] Update SDK (#50276) * [release/8.0] Update SDK * Fix IsAotCompatible warnings * Update nullability annotation for TemplatePart.Text * Update CodeGen.proj to account for conditional IsTrimmable metadata * Update Directory.Build.props.in --------- Co-authored-by: Stephen Halter <[email protected]> * Provide a better error (#50311) * Remove more setup overhead in RDG benchmarks (#50302) * Use polling to watch certificate paths (#50251) * Cache parsable and bindable type info in RDG (#50326) * Use absolute URLs for confirmation emails (#50297) This PR updates the MapIdentityApi endpoints that send confirmation emails to use absolute URLs. Previously the emails used relative links which of course do not work for links in emails. Fixes #50296 * [release/8.0] [Blazor] Close the circuit when all Blazor Server components are disposed (#50170) # [Blazor] Close the circuit when all Blazor Server components are disposed Allows a Blazor Server circuit to close when all root Blazor Server components get dynamically removed from the page. ## Description The overall approach I've taken is: 1. Define what it means for the circuit to be in use (`WebRootComponentManager.hasAnyExistingOrPendingServerComponents()`): * There are interactive Blazor Server components on the page, or... * The initialization of an interactive Blazor Server component has started, but hasn't completed yet, or... * There are SSR'd components on the page that haven't been initialized for interactivity yet (consider stream rendering, where we don't activate new components until the response completes), but they have either a "Server" or "Auto" render mode 2. Determine the cases where a circuit's "in use" status may have changed: * After a render batch is applied (see `attachCircuitAfterRenderCallback` in `WebRootComponentManager.ts`) * An applied render batch may result in the creation/disposal of a root component * After an SSR update occurs, but before the first render batch is applied * Consider the case where an SSR'd component with a Server render mode gets removed from the page, but before the circuit has a chance to initialize 3. Decide what to do if the "in use" status may have changed (`WebRootComponentManager.circuitMayHaveNoRootComponents()`): * If the circuit is not in use: * Start a timeout with some configurable duration (`SsrStartOptions.circuitInactivityTimeoutMs`), if it hasn't started already * When the timeout expires, dispose the circuit * If the circuit is not in use: * Clear any existing timeout This PR also: - [X] Addresses a bug preventing Virtualize from working correctly when a WebAssembly and Server instance is present on the page at the same time - [X] Adds E2E tests Fixes #48765 * [release/8.0] Update dependencies from dotnet/runtime (#50305) * Update dependencies from https://github.com/dotnet/runtime build 20230823.11 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23418.14 -> To Version 8.0.0-rc.2.23423.11 * Update dependencies from https://github.com/dotnet/runtime build 20230823.5 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23418.14 -> To Version 8.0.0-rc.2.23423.5 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Version.Details.xml * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20230824.1 (#50337) [release/8.0] Update dependencies from dotnet/source-build-reference-packages * Update Microsoft.Identity.Model to 7.0.0-preview3 (#50218) * Update Microsoft.Identity.Model to 7.0.0-preview3 * fixing null refs in WsFed * Add link to tracking issue. * Add link to tracking issue. * Update dependencies from https://github.com/dotnet/source-build-externals build 20230824.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 8.0.0-alpha.1.23421.1 -> To Version 8.0.0-alpha.1.23424.1 * Workaround AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#2261 in a test. --------- Co-authored-by: Eric Erhardt <[email protected]> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Versions.props * Quarantine tests (#50379) Co-authored-by: Mackinnon Buck <[email protected]> * [release/8.0] Update dependencies from dotnet/runtime (#50350) * Update dependencies from https://github.com/dotnet/runtime build 20230825.9 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23423.5 -> To Version 8.0.0-rc.2.23425.9 * Update dependencies from https://github.com/dotnet/runtime build 20230826.4 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23423.5 -> To Version 8.0.0-rc.2.23426.4 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Versions.props --------- Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Steve Sanderson <[email protected]> Co-authored-by: Safia Abdalla <[email protected]> Co-authored-by: Andrew Casey <[email protected]> Co-authored-by: Mackinnon Buck <[email protected]> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: jennyf19 <[email protected]> Co-authored-by: Eric Erhardt <[email protected]> Co-authored-by: William Godbe <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f71e2c5 commit 9402bfa

File tree

131 files changed

+2688
-1534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+2688
-1534
lines changed

Directory.Build.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Project>
22
<PropertyGroup>
3+
<!-- Disable IsTrimmable on non-DefaultNetCoreTargetFrameworks even if explicitly enabled or else we'll get NETSDK1195 and NETSDK1210 errors -->
4+
<IsTrimmable Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'"></IsTrimmable>
35
<EnableAOTAnalyzer Condition=" '$(EnableAOTAnalyzer)' == '' ">$([MSBuild]::ValueOrDefault($(IsTrimmable),'false'))</EnableAOTAnalyzer>
46
<!-- TODO: Remove when analyzer is enabled by default with AOT in SDK. See https://github.com/dotnet/sdk/issues/31284 -->
57
<EnableSingleFileAnalyzer Condition=" '$(EnableSingleFileAnalyzer)' == '' ">$(EnableAOTAnalyzer)</EnableSingleFileAnalyzer>

eng/CodeGen.proj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
<_RequiresDelayedBuild Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('RequiresDelayedBuild','true')->Distinct())" />
2525
<_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'true'))" />
2626
<_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'false'))" />
27-
<_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('IsTrimmable', 'true'))" />
2827
<_ShippingAssemblyWithDupes Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp', 'true'))" />
2928
<_ShippingAssemblyWithDupes Include="@(_ProjectReferenceProvider->WithMetadataValue('IsShippingPackage', 'true'))" />
3029
<_ShippingAssembly Include="@(_ShippingAssemblyWithDupes->Distinct())" />
30+
<!-- _ProjectReferenceProvider is already Distinct() and does not include metadata for each target framework. -->
31+
<!-- If a project is trimmable for even just one of multiple target frameworks, include it in TrimmableProjects.props. -->
32+
<_TrimmableProject Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('IsTrimmable', 'true')->WithMetadataValue('IsProjectReferenceProvider','true')->Distinct())" />
3133
</ItemGroup>
3234

3335
<PropertyGroup>

eng/Version.Details.xml

Lines changed: 142 additions & 142 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

eng/test-configuration.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{"testName": {"contains": "HEADERS_Received_SecondRequest_ConnectProtocolReset"}},
2323
{"testName": {"contains": "ClientUsingOldCallWithNewProtocol"}},
2424
{"testName": {"contains": "CertificateChangedOnDisk"}},
25+
{"testName": {"contains": "CertificateChangedOnDisk_Symlink"}},
2526
{"testAssembly": {"contains": "IIS"}},
2627
{"testAssembly": {"contains": "Template"}},
2728
{"failureMessage": {"contains":"(Site is started but no worker process found)"}},

eng/tools/GenerateFiles/Directory.Build.props.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,4 @@
88
<!-- Temporarily hardcoded to true -->
99
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
1010
</PropertyGroup>
11-
12-
<!-- Ignore warning about RID resolution rules changing in .NET 8 Preview 6 -->
13-
<!-- Needed until https://github.com/ericsink/SQLitePCL.raw/issues/543 is fixed -->
14-
<!-- See https://github.com/dotnet/aspnetcore/pull/48908#issuecomment-1601894643 -->
15-
<ItemGroup>
16-
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
17-
</ItemGroup>
1811
</Project>

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"sdk": {
3-
"version": "8.0.100-rc.1.23381.2"
3+
"version": "8.0.100-rc.2.23422.11"
44
},
55
"tools": {
6-
"dotnet": "8.0.100-rc.1.23381.2",
6+
"dotnet": "8.0.100-rc.2.23422.11",
77
"runtimes": {
88
"dotnet/x86": [
99
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"

src/Components/Components/src/CascadingParameterAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ public sealed class CascadingParameterAttribute : CascadingParameterAttributeBas
2020
/// <see cref="CascadingValue{T}"/> that supplies a value with a compatible
2121
/// type.
2222
/// </summary>
23-
public override string? Name { get; set; }
23+
public string? Name { get; set; }
2424
}

src/Components/Components/src/CascadingParameterAttributeBase.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ namespace Microsoft.AspNetCore.Components;
88
/// </summary>
99
public abstract class CascadingParameterAttributeBase : Attribute
1010
{
11-
/// <summary>
12-
/// Gets or sets the name for the parameter, which correlates to the name
13-
/// of a cascading value.
14-
/// </summary>
15-
public abstract string? Name { get; set; }
16-
1711
/// <summary>
1812
/// Gets a flag indicating whether the cascading parameter should
1913
/// be supplied only once per component.

src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using Microsoft.AspNetCore.Components;
5+
using Microsoft.Extensions.DependencyInjection.Extensions;
56

67
namespace Microsoft.Extensions.DependencyInjection;
78

@@ -16,11 +17,11 @@ public static class CascadingValueServiceCollectionExtensions
1617
/// </summary>
1718
/// <typeparam name="TValue">The value type.</typeparam>
1819
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
19-
/// <param name="valueFactory">A callback that supplies a fixed value within each service provider scope.</param>
20+
/// <param name="initialValueFactory">A callback that supplies a fixed value within each service provider scope.</param>
2021
/// <returns>The <see cref="IServiceCollection"/>.</returns>
2122
public static IServiceCollection AddCascadingValue<TValue>(
22-
this IServiceCollection serviceCollection, Func<IServiceProvider, TValue> valueFactory)
23-
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sp => new CascadingValueSource<TValue>(() => valueFactory(sp), isFixed: true));
23+
this IServiceCollection serviceCollection, Func<IServiceProvider, TValue> initialValueFactory)
24+
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sp => new CascadingValueSource<TValue>(() => initialValueFactory(sp), isFixed: true));
2425

2526
/// <summary>
2627
/// Adds a cascading value to the <paramref name="serviceCollection"/>. This is equivalent to having
@@ -29,11 +30,11 @@ public static IServiceCollection AddCascadingValue<TValue>(
2930
/// <typeparam name="TValue">The value type.</typeparam>
3031
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
3132
/// <param name="name">A name for the cascading value. If set, <see cref="CascadingParameterAttribute"/> can be configured to match based on this name.</param>
32-
/// <param name="valueFactory">A callback that supplies a fixed value within each service provider scope.</param>
33+
/// <param name="initialValueFactory">A callback that supplies a fixed value within each service provider scope.</param>
3334
/// <returns>The <see cref="IServiceCollection"/>.</returns>
3435
public static IServiceCollection AddCascadingValue<TValue>(
35-
this IServiceCollection serviceCollection, string name, Func<IServiceProvider, TValue> valueFactory)
36-
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sp => new CascadingValueSource<TValue>(name, () => valueFactory(sp), isFixed: true));
36+
this IServiceCollection serviceCollection, string name, Func<IServiceProvider, TValue> initialValueFactory)
37+
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sp => new CascadingValueSource<TValue>(name, () => initialValueFactory(sp), isFixed: true));
3738

3839
/// <summary>
3940
/// Adds a cascading value to the <paramref name="serviceCollection"/>. This is equivalent to having
@@ -50,4 +51,59 @@ public static IServiceCollection AddCascadingValue<TValue>(
5051
public static IServiceCollection AddCascadingValue<TValue>(
5152
this IServiceCollection serviceCollection, Func<IServiceProvider, CascadingValueSource<TValue>> sourceFactory)
5253
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sourceFactory);
54+
55+
/// <summary>
56+
/// Adds a cascading value to the <paramref name="serviceCollection"/>, if none is already registered
57+
/// with the value type. This is equivalent to having a fixed <see cref="CascadingValue{TValue}"/> at
58+
/// the root of the component hierarchy.
59+
/// </summary>
60+
/// <typeparam name="TValue">The value type.</typeparam>
61+
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
62+
/// <param name="valueFactory">A callback that supplies a fixed value within each service provider scope.</param>
63+
/// <returns>The <see cref="IServiceCollection"/>.</returns>
64+
public static void TryAddCascadingValue<TValue>(
65+
this IServiceCollection serviceCollection, Func<IServiceProvider, TValue> valueFactory)
66+
{
67+
serviceCollection.TryAddEnumerable(
68+
ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>(
69+
sp => new CascadingValueSource<TValue>(() => valueFactory(sp), isFixed: true)));
70+
}
71+
72+
/// <summary>
73+
/// Adds a cascading value to the <paramref name="serviceCollection"/>, if none is already registered
74+
/// with the value type, regardless of the <paramref name="name"/>. This is equivalent to having a fixed
75+
/// <see cref="CascadingValue{TValue}"/> at the root of the component hierarchy.
76+
/// </summary>
77+
/// <typeparam name="TValue">The value type.</typeparam>
78+
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
79+
/// <param name="name">A name for the cascading value. If set, <see cref="CascadingParameterAttribute"/> can be configured to match based on this name.</param>
80+
/// <param name="valueFactory">A callback that supplies a fixed value within each service provider scope.</param>
81+
/// <returns>The <see cref="IServiceCollection"/>.</returns>
82+
public static void TryAddCascadingValue<TValue>(
83+
this IServiceCollection serviceCollection, string name, Func<IServiceProvider, TValue> valueFactory)
84+
{
85+
serviceCollection.TryAddEnumerable(
86+
ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>(
87+
sp => new CascadingValueSource<TValue>(name, () => valueFactory(sp), isFixed: true)));
88+
}
89+
90+
/// <summary>
91+
/// Adds a cascading value to the <paramref name="serviceCollection"/>, if none is already registered
92+
/// with the value type. This is equivalent to having a fixed <see cref="CascadingValue{TValue}"/> at
93+
/// the root of the component hierarchy.
94+
///
95+
/// With this overload, you can supply a <see cref="CascadingValueSource{TValue}"/> which allows you
96+
/// to notify about updates to the value later, causing recipients to re-render. This overload should
97+
/// only be used if you plan to update the value dynamically.
98+
/// </summary>
99+
/// <typeparam name="TValue">The value type.</typeparam>
100+
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
101+
/// <param name="sourceFactory">A callback that supplies a <see cref="CascadingValueSource{TValue}"/> within each service provider scope.</param>
102+
/// <returns>The <see cref="IServiceCollection"/>.</returns>
103+
public static void TryAddCascadingValue<TValue>(
104+
this IServiceCollection serviceCollection, Func<IServiceProvider, CascadingValueSource<TValue>> sourceFactory)
105+
{
106+
serviceCollection.TryAddEnumerable(
107+
ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>(sourceFactory));
108+
}
53109
}

src/Components/Components/src/CascadingValueSource.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ public CascadingValueSource(string name, TValue value, bool isFixed) : this(valu
4848
/// <summary>
4949
/// Constructs an instance of <see cref="CascadingValueSource{TValue}"/>.
5050
/// </summary>
51-
/// <param name="valueFactory">A callback that produces the initial value when first required.</param>
51+
/// <param name="initialValueFactory">A callback that produces the initial value when first required.</param>
5252
/// <param name="isFixed">A flag to indicate whether the value is fixed. If false, all receipients will subscribe for update notifications, which you can issue by calling <see cref="NotifyChangedAsync()"/>. These subscriptions come at a performance cost, so if the value will not change, set <paramref name="isFixed"/> to true.</param>
53-
public CascadingValueSource(Func<TValue> valueFactory, bool isFixed) : this(isFixed)
53+
public CascadingValueSource(Func<TValue> initialValueFactory, bool isFixed) : this(isFixed)
5454
{
55-
_initialValueFactory = valueFactory;
55+
_initialValueFactory = initialValueFactory;
5656
}
5757

5858
/// <summary>
5959
/// Constructs an instance of <see cref="CascadingValueSource{TValue}"/>.
6060
/// </summary>
6161
/// <param name="name">A name for the cascading value. If set, <see cref="CascadingParameterAttribute"/> can be configured to match based on this name.</param>
62-
/// <param name="valueFactory">A callback that produces the initial value when first required.</param>
62+
/// <param name="initialValueFactory">A callback that produces the initial value when first required.</param>
6363
/// <param name="isFixed">A flag to indicate whether the value is fixed. If false, all receipients will subscribe for update notifications, which you can issue by calling <see cref="NotifyChangedAsync()"/>. These subscriptions come at a performance cost, so if the value will not change, set <paramref name="isFixed"/> to true.</param>
64-
public CascadingValueSource(string name, Func<TValue> valueFactory, bool isFixed) : this(valueFactory, isFixed)
64+
public CascadingValueSource(string name, Func<TValue> initialValueFactory, bool isFixed) : this(initialValueFactory, isFixed)
6565
{
6666
ArgumentNullException.ThrowIfNull(name);
6767
_name = name;

0 commit comments

Comments
 (0)