Skip to content

Commit 81a4885

Browse files
wtgodbedotnet-maestro[bot]javiercngithub-actions[bot]Copilot
authored
[automated] Merge branch 'release/10.0' => 'main' (#63512)
* Merge pull request #63458 from dotnet/darc-release/10.0-0b5f1d61-512f-46bf-9db1-6245ce11f284 [release/10.0] Source code updates from dotnet/dotnet * Add unsupported compat switch for property injection (#63493) * [release/10.0] Remove duplicate RedirectManager injection in Blazor Web App ChangePassword template (#63452) * Initial plan * Fix duplicate RedirectManager injection in ChangePassword.razor template Co-authored-by: ilonatommy <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ilonatommy <[email protected]> * Update .NET SDK version in global.json --------- Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Javier Calvarro Nelson <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ilonatommy <[email protected]> Co-authored-by: William Godbe <[email protected]>
2 parents 5edb4e8 + 76fea70 commit 81a4885

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"sdk": {
3-
"version": "10.0.100-rc.1.25411.109",
3+
"version": "10.0.100-rc.1.25420.111",
44
"paths": [
55
".dotnet",
66
"$host$"
77
],
88
"errorMessage": "The .NET SDK could not be found, run ./restore.cmd or ./restore.sh first."
99
},
1010
"tools": {
11-
"dotnet": "10.0.100-rc.1.25411.109",
11+
"dotnet": "10.0.100-rc.1.25420.111",
1212
"runtimes": {
1313
"dotnet/x86": [
1414
"$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)"

src/Components/Components/src/ComponentFactory.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ namespace Microsoft.AspNetCore.Components;
1414

1515
internal sealed class ComponentFactory
1616
{
17+
// This switch is unsupported and will be removed in a future version.
18+
private static readonly bool _propertyInjectionDisabled =
19+
AppContext.TryGetSwitch("Microsoft.AspNetCore.Components.Unsupported.DisablePropertyInjection", out var isDisabled) &&
20+
isDisabled;
21+
1722
private const BindingFlags _injectablePropertyBindingFlags
1823
= BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
1924

@@ -82,15 +87,18 @@ public IComponent InstantiateComponent(IServiceProvider serviceProvider, [Dynami
8287
throw new InvalidOperationException($"The component activator returned a null value for a component of type {componentType.FullName}.");
8388
}
8489

85-
if (component.GetType() == componentType)
86-
{
87-
// Fast, common case: use the cached data we already looked up
88-
propertyInjector(serviceProvider, component);
89-
}
90-
else
90+
if (!_propertyInjectionDisabled)
9191
{
92-
// Uncommon case where the activator/resolver returned a different type. Needs an extra cache lookup.
93-
PerformPropertyInjection(serviceProvider, component);
92+
if (component.GetType() == componentType)
93+
{
94+
// Fast, common case: use the cached data we already looked up
95+
propertyInjector(serviceProvider, component);
96+
}
97+
else
98+
{
99+
// Uncommon case where the activator/resolver returned a different type. Needs an extra cache lookup.
100+
PerformPropertyInjection(serviceProvider, component);
101+
}
94102
}
95103

96104
return component;

0 commit comments

Comments
 (0)