Skip to content

Commit 55fe8ef

Browse files
committed
Cleanups
1 parent 85a8317 commit 55fe8ef

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/Components/Components/src/PersistentState/PersistentServicesRegistry.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ internal void RegisterForPersistence(PersistentComponentState state)
8282
state.PersistAsJson(_registryKey, _registrations);
8383
return Task.CompletedTask;
8484
}, RenderMode),
85-
state.RegisterOnRestoring(() =>
86-
{
87-
RestoreRegistrationsIfAvailable(state);
88-
}, new RestoreOptions { RestoreBehavior = RestoreBehavior.SkipLastSnapshot })));
85+
default));
8986
}
9087

9188
_subscriptions = subscriptions;
@@ -118,25 +115,6 @@ private void UpdateRegistrations(PersistentComponentState state)
118115
}
119116
}
120117

121-
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "Types registered for persistence are preserved in the API call to register them and typically live in assemblies that aren't trimmed.")]
122-
private void RestoreRegistrationsIfAvailable(PersistentComponentState state)
123-
{
124-
foreach (var registration in _registrations)
125-
{
126-
var type = ResolveType(registration);
127-
if (type == null)
128-
{
129-
continue;
130-
}
131-
132-
var instance = _serviceProvider.GetService(type);
133-
if (instance != null)
134-
{
135-
RestoreInstanceState(instance, type, state);
136-
}
137-
}
138-
}
139-
140118
[RequiresUnreferencedCode("Calls Microsoft.AspNetCore.Components.PersistentComponentState.TryTakeFromJson(String, Type, out Object)")]
141119
private static void RestoreInstanceState(object instance, Type type, PersistentComponentState state)
142120
{

0 commit comments

Comments
 (0)