6 types derived from ComponentState
Microsoft.AspNetCore.Components.Authorization.Tests (1)
src\Components\Shared\test\TestRenderer.cs (1)
151class TestRendererComponentState : ComponentState, IAsyncDisposable
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointComponentState.cs (1)
15internal sealed class EndpointComponentState : ComponentState
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
ImportMapTest.cs (1)
360class TestRendererComponentState : ComponentState, IAsyncDisposable
Microsoft.AspNetCore.Components.Forms.Tests (1)
src\Components\Shared\test\TestRenderer.cs (1)
151class TestRendererComponentState : ComponentState, IAsyncDisposable
Microsoft.AspNetCore.Components.Tests (1)
src\Components\Shared\test\TestRenderer.cs (1)
151class TestRendererComponentState : ComponentState, IAsyncDisposable
Microsoft.AspNetCore.Components.Web.Tests (1)
src\Components\Shared\test\TestRenderer.cs (1)
151class TestRendererComponentState : ComponentState, IAsyncDisposable
3 instantiations of ComponentState
Microsoft.AspNetCore.Components (1)
RenderTree\Renderer.cs (1)
400=> new ComponentState(this, componentId, component, parentComponentState);
Microsoft.AspNetCore.Components.Server.Tests (1)
Circuits\RenderBatchWriterTest.cs (1)
206.WithComponent(new ComponentState(renderer, 2000, new FakeComponent(), null)),
Microsoft.AspNetCore.Components.Tests (1)
CascadingParameterStateTest.cs (1)
420return new ComponentState(new TestRenderer(), 0, component, parentComponentState);
174 references to ComponentState
Microsoft.AspNetCore.Components (93)
CascadingParameterState.cs (3)
27public static IReadOnlyList<CascadingParameterState> FindCascadingParameters(ComponentState componentState, out bool hasSingleDeliveryParameters) 76internal static ICascadingValueSupplier? GetMatchingCascadingValueSupplier(in CascadingParameterInfo info, Renderer renderer, ComponentState? componentState) 79var candidate = componentState;
CascadingValue.cs (5)
14private HashSet<ComponentState>? _subscribers; // Lazily instantiated 148void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 157_subscribers ??= new HashSet<ComponentState>(); 161void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 168foreach (var subscriber in _subscribers!)
CascadingValueSource.cs (5)
19private readonly ConcurrentDictionary<Dispatcher, List<ComponentState>>? _subscribers; 104: new ComponentState[subscribersCount]; 163void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 172void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 194private ComponentState _values;
ICascadingValueSupplier.cs (2)
16void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo); 18void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo);
Rendering\ComponentState.cs (8)
28/// Constructs an instance of <see cref="ComponentState"/>. 33/// <param name="parentComponentState">The <see cref="ComponentState"/> for the parent component, or null if this is a root component.</param> 34public ComponentState(Renderer renderer, int componentId, IComponent component, ComponentState? parentComponentState) 56private static ComponentState? GetSectionOutletLogicalParent(Renderer renderer, SectionOutlet sectionOutlet) 79/// Gets the <see cref="ComponentState"/> of the parent component, or null if this is a root component. 81public ComponentState? ParentComponentState { get; } 84/// Gets the <see cref="ComponentState"/> of the logical parent component, or null if this is a root component. 86public ComponentState? LogicalParentComponentState { get; }
Rendering\RenderQueueEntry.cs (2)
11public readonly ComponentState ComponentState; 14public RenderQueueEntry(ComponentState componentState, RenderFragment renderFragment)
RenderTree\Renderer.cs (43)
30private readonly Dictionary<int, ComponentState> _componentStateById = new Dictionary<int, ComponentState>(); 31private readonly Dictionary<IComponent, ComponentState> _componentStateByComponent = new Dictionary<IComponent, ComponentState>(); 136/// Gets the <see cref="ComponentState"/> associated with the specified component. 139/// <returns>The corresponding <see cref="ComponentState"/>.</returns> 140protected ComponentState GetComponentState(int componentId) 159protected internal ComponentState GetComponentState(IComponent component) 191var componentState = GetRequiredComponentState(componentId); 281var componentState = GetRequiredRootComponentState(componentId); 374private ComponentState AttachAndInitComponent(IComponent component, int parentComponentId) 377var parentComponentState = GetOptionalComponentState(parentComponentId); 378var componentState = CreateComponentState(componentId, component, parentComponentState); 384internal void RegisterComponentState(IComponent component, int componentId, ComponentState componentState) 391/// Creates a <see cref="ComponentState"/> instance to track state associated with a newly-instantiated component. 393/// may override this method to use their own subclasses of <see cref="ComponentState"/>. 397/// <param name="parentComponentState">The <see cref="ComponentState"/> associated with the parent component, or null if this is a root component.</param> 398/// <returns>A <see cref="ComponentState"/> for the new component.</returns> 399protected virtual ComponentState CreateComponentState(int componentId, IComponent component, ComponentState? parentComponentState) 464ComponentState? receiverComponentState = null; 534internal ComponentState InstantiateChildComponentOnFrame(RenderTreeFrame[] frames, int frameIndex, int parentComponentId) 552var newComponentState = AttachAndInitComponent(newComponent, parentComponentId); 583internal void AddToPendingTasksWithErrorHandling(Task task, ComponentState? owningComponentState) 615/// <param name="componentState">The <see cref="ComponentState"/> for the component associated with this pending task, if any.</param> 617protected virtual void AddPendingTask(ComponentState? componentState, Task task) 667var componentState = GetOptionalComponentState(componentId); 712private ComponentState GetRequiredComponentState(int componentId) 713=> _componentStateById.TryGetValue(componentId, out var componentState) 717private ComponentState? GetOptionalComponentState(int componentId) 718=> _componentStateById.TryGetValue(componentId, out var componentState) 722private ComponentState GetRequiredRootComponentState(int componentId) 724var componentState = GetRequiredComponentState(componentId); 849var componentState = GetOptionalComponentState(array[i].ComponentId); 884var componentState = GetOptionalComponentState(array[i]); 898private void NotifyRenderCompleted(ComponentState state, ref List<Task> batch) 933var componentState = renderQueueEntry.ComponentState; 955var disposeComponentState = GetRequiredComponentState(disposeComponentId); 1055private async Task GetErrorHandledTask(Task taskToHandle, ComponentState? owningComponentState) 1073var componentState = GetOptionalComponentState(fieldInfo.ComponentId); 1090private void HandleExceptionViaErrorBoundary(Exception error, ComponentState? errorSourceOrNull) 1106var candidate = errorSourceOrNull; 1188foreach (var componentState in _componentStateById.Values)
RenderTree\Renderer.Log.cs (4)
19public static void InitializingComponent(ILogger logger, ComponentState componentState, ComponentState parentComponentState) 37public static void RenderingComponent(ILogger logger, ComponentState componentState) 48public static void DisposingComponent(ILogger logger, ComponentState componentState)
RenderTree\RenderTreeDiffBuilder.cs (2)
697var componentState = oldFrame.ComponentStateField; 963var childComponentState = diffContext.Renderer.InstantiateChildComponentOnFrame(frames, frameIndex, parentComponentId);
RenderTree\RenderTreeFrame.cs (4)
145[FieldOffset(24)] internal ComponentState ComponentStateField; 177internal ComponentState ComponentState => ComponentStateField; 316private RenderTreeFrame(int sequence, int componentSubtreeLength, [DynamicallyAccessedMembers(LinkerFlags.Component)] Type componentType, ComponentState componentState, object componentKey) 432internal RenderTreeFrame WithComponent(ComponentState componentState)
Routing\SupplyParameterFromQueryValueProvider.cs (4)
14private HashSet<ComponentState>? _subscribers; 15private HashSet<ComponentState>? _pendingSubscribers; 35public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 51public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
SupplyParameterFromPersistentComponentStateValueProvider.cs (11)
23private readonly Dictionary<ComponentState, PersistingComponentStateSubscription> _subscriptions = []; 27internal Dictionary<ComponentState, PersistingComponentStateSubscription> Subscriptions => _subscriptions; 42var componentState = (ComponentState)key!; 49public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 91public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 101internal static string ComputeKey(ComponentState componentState, string propertyName) 127private static string ComputeFinalKey(byte[] preKey, ComponentState componentState) 222private static object? GetSerializableKey(ComponentState componentState) 248private static string GetComponentType(ComponentState componentState) => componentState.Component.GetType().FullName!; 250private static string GetParentComponentType(ComponentState componentState) =>
Microsoft.AspNetCore.Components.Authorization.Tests (3)
src\Components\Shared\test\TestRenderer.cs (3)
138protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState parentComponentState) 155public TestRendererComponentState(Renderer renderer, int componentId, IComponent component, ComponentState parentComponentState)
Microsoft.AspNetCore.Components.Endpoints (11)
Rendering\EndpointComponentState.cs (1)
19public EndpointComponentState(Renderer renderer, int componentId, IComponent component, ComponentState? parentComponentState)
Rendering\EndpointHtmlRenderer.cs (3)
155protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState? parentComponentState) 164protected override void AddPendingTask(ComponentState? componentState, Task task)
Rendering\EndpointHtmlRenderer.EventDispatch.cs (2)
202for (var current = GetComponentState(componentId); current != null; current = current.ParentComponentState) 211static string GetName(ComponentState current) => current.Component.GetType().Name;
Rendering\EndpointHtmlRenderer.Prerendering.cs (4)
45var componentState = GetComponentState(component); 58var componentState = GetComponentState(componentId); 62private static SSRRenderModeBoundary? GetClosestRenderModeBoundary(ComponentState componentState) 64var currentComponentState = componentState;
Rendering\EndpointHtmlRenderer.Streaming.cs (1)
194var componentState = GetComponentState(componentId);
Microsoft.AspNetCore.Components.Endpoints.Tests (3)
ImportMapTest.cs (3)
347protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState parentComponentState) 364public TestRendererComponentState(Renderer renderer, int componentId, IComponent component, ComponentState parentComponentState)
Microsoft.AspNetCore.Components.Forms.Tests (3)
src\Components\Shared\test\TestRenderer.cs (3)
138protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState parentComponentState) 155public TestRendererComponentState(Renderer renderer, int componentId, IComponent component, ComponentState parentComponentState)
Microsoft.AspNetCore.Components.Server.Tests (7)
Circuits\CircuitHostTest.cs (6)
431var componentState = ((TestRemoteRenderer)circuitHost.Renderer).GetTestComponentState(0); 457var componentState = ((TestRemoteRenderer)circuitHost.Renderer).GetTestComponentState(0); 484var componentState = ((TestRemoteRenderer)circuitHost.Renderer).GetTestComponentState(1); 518var componentState = ((TestRemoteRenderer)circuitHost.Renderer).GetTestComponentState(0); 555var componentState = ((TestRemoteRenderer)circuitHost.Renderer).GetTestComponentState(0); 720public ComponentState GetTestComponentState(int id)
Circuits\RemoteRendererTest.cs (1)
720public new ComponentState GetComponentState(int componentId)
Microsoft.AspNetCore.Components.Tests (42)
CascadingParameterStateTest.cs (9)
16var componentState = CreateComponentState(new ComponentWithNoParams()); 29var componentState = CreateComponentState(new ComponentWithNoCascadingParams()); 42var componentState = CreateComponentState(new ComponentWithCascadingParams()); 403static ComponentState[] CreateAncestry(params IComponent[] components) 405var result = new ComponentState[components.Length]; 417static ComponentState CreateComponentState( 418IComponent component, ComponentState parentComponentState = null) 492public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 495public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
CascadingParameterTest.cs (4)
891public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 894public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 1061void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 1066void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
ParameterViewTest.Assignment.cs (2)
798public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 803public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
ParameterViewTest.cs (2)
615public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 618public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
src\Components\Shared\test\TestRenderer.cs (3)
138protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState parentComponentState) 155public TestRendererComponentState(Renderer renderer, int componentId, IComponent component, ComponentState parentComponentState)
SupplyParameterFromPersistentComponentStateValueProviderTests.cs (22)
32var componentState = componentStates.First(); 36new List<(ComponentState, string, string)> 59var componentState = componentStates.First(); 81var componentState = componentStates.First(); 107var componentState = componentStates.First(); 146var componentState = componentStates.First(); 185var componentState1 = componentStates.First(); 186var componentState2 = componentStates.Last(); 258var componentState1 = componentStates.First(); 259var componentState2 = componentStates.Last(); 303var componentState1 = componentStates.First(); 304var componentState2 = componentStates.Last(); 344var componentState1 = componentStates.First(); 345var componentState2 = componentStates.Last(); 377var componentState1 = componentStates.First(); 378var componentState2 = componentStates.Last(); 417var componentState1 = componentStates.First(); 418var componentState2 = componentStates.Last(); 434private static void InitializeState(PersistentComponentState state, List<(ComponentState componentState, string propertyName, string value)> items) 453private static List<ComponentState> CreateComponentState( 461var result = new List<ComponentState>(); 464var componentState = new ComponentState(renderer, i++, component, parentComponentState);
Microsoft.AspNetCore.Components.Web (7)
Forms\Editor.cs (2)
64void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 69void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
Forms\Mapping\FormMappingScope.cs (2)
89void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 92void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
Forms\Mapping\SupplyParameterFromFormValueProvider.cs (2)
66void ICascadingValueSupplier.Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo) 69void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
HtmlRendering\StaticHtmlRenderer.HtmlWriting.cs (1)
249var componentState = GetComponentState(forComponentId);
Microsoft.AspNetCore.Components.Web.Tests (5)
Forms\Mapping\SupplyParameterFromFormTest.cs (2)
22var formComponentState = renderer.GetComponentState(formComponent); 50var formComponentState = renderer.Batches.Single()
src\Components\Shared\test\TestRenderer.cs (3)
138protected override ComponentState CreateComponentState(int componentId, IComponent component, ComponentState parentComponentState) 155public TestRendererComponentState(Renderer renderer, int componentId, IComponent component, ComponentState parentComponentState)