Skip to content

Commit 2a42951

Browse files
committed
Fix build
1 parent 3b86f05 commit 2a42951

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

src/Components/Components/src/PersistentState/WebPersistenceFilter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ internal WebPersistenceFilter(WebPersistenceScenarioType scenarioType, bool enab
3838
/// </example>
3939
public static WebPersistenceFilter Reconnection { get; } = new(WebPersistenceScenarioType.Reconnection, enabled: true);
4040

41+
/// <summary>
42+
/// Gets a filter that enables state restoration during enhanced navigation scenarios.
43+
/// </summary>
4144
public static WebPersistenceFilter EnhancedNavigation { get; } = new(WebPersistenceScenarioType.EnhancedNavigation, enabled: true);
4245

4346
/// <summary>

src/Components/Components/src/PersistentState/WebPersistenceScenario.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ private WebPersistenceScenario(WebPersistenceScenarioType scenarioType, bool isR
5151
/// </example>
5252
public static WebPersistenceScenario Reconnection { get; } = new(WebPersistenceScenarioType.Reconnection, isRecurring: false);
5353

54+
/// <summary>
55+
/// Gets a scenario representing enhanced navigation state restoration.
56+
/// This scenario can occur multiple times during enhanced page navigation.
57+
/// </summary>
5458
public static WebPersistenceScenario EnhancedNavigation { get; } = new(WebPersistenceScenarioType.EnhancedNavigation, isRecurring: true);
5559

5660
private string GetDebuggerDisplay() => $"{ScenarioType} (IsRecurring: {IsRecurring})";

src/Components/Components/src/PersistentStateValueProvider.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ public bool CanSupplyValue(in CascadingParameterInfo parameterInfo)
5252
return null;
5353
}
5454

55-
[UnconditionalSuppressMessage("Trimming", "IL2075:'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
56-
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "OpenComponent already has the right set of attributes")]
57-
[UnconditionalSuppressMessage("Trimming", "IL2072:Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
5855
public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
5956
{
6057
var propertyName = parameterInfo.PropertyName;
@@ -446,6 +443,10 @@ public ComponentSubscription(
446443
return _lastValue;
447444
}
448445

446+
[UnconditionalSuppressMessage("Trimming", "IL2075:'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
447+
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "OpenComponent already has the right set of attributes")]
448+
[UnconditionalSuppressMessage("Trimming", "IL2072:Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
449+
[UnconditionalSuppressMessage("Trimming", "IL2077:'type' argument does not satisfy 'DynamicallyAccessedMemberTypes' in call to target method. The source field does not have matching annotations.", Justification = "Property types on components are preserved through other means.")]
449450
private Task PersistProperty()
450451
{
451452
// The key needs to be computed here, do not move this outside of the lambda.
@@ -474,6 +475,10 @@ private Task PersistProperty()
474475
return Task.CompletedTask;
475476
}
476477

478+
[UnconditionalSuppressMessage("Trimming", "IL2075:'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
479+
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "OpenComponent already has the right set of attributes")]
480+
[UnconditionalSuppressMessage("Trimming", "IL2072:Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "OpenComponent already has the right set of attributes")]
481+
[UnconditionalSuppressMessage("Trimming", "IL2077:'type' argument does not satisfy 'DynamicallyAccessedMemberTypes' in call to target method. The source field does not have matching annotations.", Justification = "Property types on components are preserved through other means.")]
477482
private void RestoreProperty()
478483
{
479484
if (!_hasComputedValueFirstTime)

src/Components/Components/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ Microsoft.AspNetCore.Components.PersistentComponentStateSerializer<T>
2222
Microsoft.AspNetCore.Components.PersistentComponentStateSerializer<T>.PersistentComponentStateSerializer() -> void
2323
abstract Microsoft.AspNetCore.Components.PersistentComponentStateSerializer<T>.Persist(T value, System.Buffers.IBufferWriter<byte>! writer) -> void
2424
abstract Microsoft.AspNetCore.Components.PersistentComponentStateSerializer<T>.Restore(System.Buffers.ReadOnlySequence<byte> data) -> T
25+
Microsoft.AspNetCore.Components.UpdateStateOnEnhancedNavigation
26+
Microsoft.AspNetCore.Components.UpdateStateOnEnhancedNavigation.UpdateStateOnEnhancedNavigation(bool enable = false) -> void
2527
static Microsoft.AspNetCore.Components.Infrastructure.RegisterPersistentComponentStateServiceCollectionExtensions.AddPersistentServiceRegistration<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection! services, Microsoft.AspNetCore.Components.IComponentRenderMode! componentRenderMode) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
2628
static Microsoft.AspNetCore.Components.Infrastructure.ComponentsMetricsServiceCollectionExtensions.AddComponentsMetrics(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
2729
static Microsoft.AspNetCore.Components.Infrastructure.ComponentsMetricsServiceCollectionExtensions.AddComponentsTracing(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
30+
static Microsoft.AspNetCore.Components.WebPersistenceFilter.EnhancedNavigation.get -> Microsoft.AspNetCore.Components.WebPersistenceFilter!
31+
static Microsoft.AspNetCore.Components.WebPersistenceScenario.EnhancedNavigation.get -> Microsoft.AspNetCore.Components.WebPersistenceScenario!
2832
virtual Microsoft.AspNetCore.Components.OwningComponentBase.DisposeAsyncCore() -> System.Threading.Tasks.ValueTask
2933
static Microsoft.AspNetCore.Components.Infrastructure.PersistentStateProviderServiceCollectionExtensions.AddSupplyValueFromPersistentComponentStateProvider(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
3034
virtual Microsoft.AspNetCore.Components.Rendering.ComponentState.GetComponentKey() -> object?

src/Components/Components/test/PersistentStateValueProviderTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ public void Subscribe_WithRestoreOnPrerenderingAttribute_CreatesCorrectSubscript
757757
provider.Subscribe(componentState, cascadingParameterInfo);
758758

759759
// Assert
760-
Assert.True(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
761-
var subscription = provider.Subscriptions[(componentState, nameof(TestComponentWithFilteredState.PrerenderState))];
760+
Assert.True(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
761+
var subscription = provider.Subscriptions[new(componentState, nameof(TestComponentWithFilteredState.PrerenderState))];
762762
}
763763

764764
[Fact]
@@ -781,16 +781,16 @@ public void Subscribe_WithFilteredProperty_CreatesValidSubscription()
781781

782782
// Act & Assert - Subscribe to prerender state
783783
provider.Subscribe(componentState, prerenderInfo);
784-
Assert.True(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
784+
Assert.True(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
785785

786786
// Act & Assert - Subscribe to normal state should work too
787787
provider.Subscribe(componentState, normalInfo);
788-
Assert.True(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.NormalState))));
788+
Assert.True(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.NormalState))));
789789

790790
// Verify subscription structure is valid and was created
791-
var subscription = provider.Subscriptions[(componentState, nameof(TestComponentWithFilteredState.NormalState))];
791+
var subscription = provider.Subscriptions[new(componentState, nameof(TestComponentWithFilteredState.NormalState))];
792792
// PersistingComponentStateSubscription is a value type, so just verify the subscription exists
793-
Assert.True(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.NormalState))));
793+
Assert.True(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.NormalState))));
794794
}
795795

796796
[Fact]
@@ -811,11 +811,11 @@ public void Unsubscribe_RemovesSubscriptionCorrectly()
811811

812812
// Act - Subscribe then unsubscribe
813813
provider.Subscribe(componentState, cascadingParameterInfo);
814-
Assert.True(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
814+
Assert.True(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
815815

816816
provider.Unsubscribe(componentState, cascadingParameterInfo);
817817

818818
// Assert - Subscription should be removed
819-
Assert.False(provider.Subscriptions.ContainsKey((componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
819+
Assert.False(provider.Subscriptions.ContainsKey(new(componentState, nameof(TestComponentWithFilteredState.PrerenderState))));
820820
}
821821
}

src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics;
54
using System.Diagnostics.CodeAnalysis;
65
using System.Runtime.CompilerServices;
76
using System.Runtime.InteropServices.JavaScript;

src/Components/test/E2ETest/Tests/StatePersistenceTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ private void ValidateEnhancedNavState(
208208
Browser.Equal($"Render mode: {renderMode}", () => Browser.FindElement(By.Id("render-mode")).Text);
209209
Browser.Equal($"Streaming id:{streamingId}", () => Browser.FindElement(By.Id("streaming-id")).Text);
210210
Browser.Equal($"Interactive: {interactive}", () => Browser.FindElement(By.Id("interactive")).Text);
211-
+
212211
if (streamingId == null || streamingCompleted)
213212
{
214213
Browser.Equal($"Enhanced nav state found:{enhancedNavStateFound}", () => Browser.FindElement(By.Id("enhanced-nav-state-found")).Text);

0 commit comments

Comments
 (0)