Rename Invoke -> InvokeAsync

This commit is contained in:
Ryan Nowak 2019-07-02 12:14:18 -07:00
parent edf5abed26
commit db0d065b76
15 changed files with 83 additions and 83 deletions

View File

@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Components
{
public ComponentBase() { }
protected virtual void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { }
protected System.Threading.Tasks.Task Invoke(System.Action workItem) { throw null; }
protected System.Threading.Tasks.Task InvokeAsync(System.Action workItem) { throw null; }
protected System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem) { throw null; }
void Microsoft.AspNetCore.Components.IComponent.Configure(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; }
@ -318,6 +318,13 @@ namespace Microsoft.AspNetCore.Components
{
bool IsConnected { get; }
}
public partial interface IDispatcher
{
System.Threading.Tasks.Task InvokeAsync(System.Action workItem);
System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem);
System.Threading.Tasks.Task<TResult> InvokeAsync<TResult>(System.Func<System.Threading.Tasks.Task<TResult>> workItem);
System.Threading.Tasks.Task<TResult> InvokeAsync<TResult>(System.Func<TResult> workItem);
}
public partial interface IHandleAfterRender
{
System.Threading.Tasks.Task OnAfterRenderAsync();
@ -403,7 +410,7 @@ namespace Microsoft.AspNetCore.Components
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsInitialized { get { throw null; } }
public System.Threading.Tasks.Task Invoke(System.Action workItem) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(System.Action workItem) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem) { throw null; }
public void Render(Microsoft.AspNetCore.Components.RenderFragment renderFragment) { }
}
@ -683,20 +690,13 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
public partial class HtmlRenderer : Microsoft.AspNetCore.Components.Rendering.Renderer
{
public HtmlRenderer(System.IServiceProvider serviceProvider, System.Func<string, string> htmlEncoder, Microsoft.AspNetCore.Components.Rendering.IDispatcher dispatcher) : base (default(System.IServiceProvider)) { }
public HtmlRenderer(System.IServiceProvider serviceProvider, System.Func<string, string> htmlEncoder, Microsoft.AspNetCore.Components.IDispatcher dispatcher) : base (default(System.IServiceProvider)) { }
protected override void HandleException(System.Exception exception) { }
[System.Diagnostics.DebuggerStepThroughAttribute]
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Components.Rendering.ComponentRenderedText> RenderComponentAsync(System.Type componentType, Microsoft.AspNetCore.Components.ParameterCollection initialParameters) { throw null; }
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Components.Rendering.ComponentRenderedText> RenderComponentAsync<TComponent>(Microsoft.AspNetCore.Components.ParameterCollection initialParameters) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch renderBatch) { throw null; }
}
public partial interface IDispatcher
{
System.Threading.Tasks.Task Invoke(System.Action action);
System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> asyncAction);
System.Threading.Tasks.Task<TResult> InvokeAsync<TResult>(System.Func<System.Threading.Tasks.Task<TResult>> asyncFunction);
System.Threading.Tasks.Task<TResult> Invoke<TResult>(System.Func<TResult> function);
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct RenderBatch
{
@ -709,17 +709,17 @@ namespace Microsoft.AspNetCore.Components.Rendering
public abstract partial class Renderer : System.IDisposable
{
public Renderer(System.IServiceProvider serviceProvider) { }
public Renderer(System.IServiceProvider serviceProvider, Microsoft.AspNetCore.Components.Rendering.IDispatcher dispatcher) { }
public Renderer(System.IServiceProvider serviceProvider, Microsoft.AspNetCore.Components.IDispatcher dispatcher) { }
public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } }
protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { }
protected internal int AssignRootComponentId(Microsoft.AspNetCore.Components.IComponent component) { throw null; }
public static Microsoft.AspNetCore.Components.Rendering.IDispatcher CreateDefaultDispatcher() { throw null; }
public static Microsoft.AspNetCore.Components.IDispatcher CreateDefaultDispatcher() { throw null; }
public virtual System.Threading.Tasks.Task DispatchEventAsync(int eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
protected abstract void HandleException(System.Exception exception);
protected Microsoft.AspNetCore.Components.IComponent InstantiateComponent(System.Type componentType) { throw null; }
public virtual System.Threading.Tasks.Task Invoke(System.Action workItem) { throw null; }
public virtual System.Threading.Tasks.Task InvokeAsync(System.Action workItem) { throw null; }
public virtual System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem) { throw null; }
protected System.Threading.Tasks.Task RenderRootComponentAsync(int componentId) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute]

View File

@ -22,7 +22,7 @@
private void OnAuthenticationStateChanged(Task<AuthenticationState> newAuthStateTask)
{
Invoke(() =>
_ = InvokeAsync(() =>
{
_currentAuthenticationStateTask = newAuthStateTask;
StateHasChanged();

View File

@ -147,8 +147,8 @@ namespace Microsoft.AspNetCore.Components
/// synchronization context.
/// </summary>
/// <param name="workItem">The work item to execute.</param>
protected Task Invoke(Action workItem)
=> _renderHandle.Invoke(workItem);
protected Task InvokeAsync(Action workItem)
=> _renderHandle.InvokeAsync(workItem);
/// <summary>
/// Executes the supplied work item on the associated renderer's

View File

@ -3,8 +3,9 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Rendering;
namespace Microsoft.AspNetCore.Components.Rendering
namespace Microsoft.AspNetCore.Components
{
/// <summary>
/// Dispatches external actions to be executed on the context of a <see cref="Renderer"/>.
@ -14,29 +15,29 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// <summary>
/// Invokes the given <see cref="Action"/> in the context of the associated <see cref="Renderer"/>.
/// </summary>
/// <param name="action">The action to execute.</param>
/// <param name="workItem">The action to execute.</param>
/// <returns>A <see cref="Task"/> that will be completed when the action has finished executing.</returns>
Task Invoke(Action action);
Task InvokeAsync(Action workItem);
/// <summary>
/// Invokes the given <see cref="Func{TResult}"/> in the context of the associated <see cref="Renderer"/>.
/// </summary>
/// <param name="asyncAction">The asynchronous action to execute.</param>
/// <param name="workItem">The asynchronous action to execute.</param>
/// <returns>A <see cref="Task"/> that will be completed when the action has finished executing.</returns>
Task InvokeAsync(Func<Task> asyncAction);
Task InvokeAsync(Func<Task> workItem);
/// <summary>
/// Invokes the given <see cref="Func{TResult}"/> in the context of the associated <see cref="Renderer"/>.
/// </summary>
/// <param name="function">The function to execute.</param>
/// <param name="workItem">The function to execute.</param>
/// <returns>A <see cref="Task{TResult}"/> that will be completed when the function has finished executing.</returns>
Task<TResult> Invoke<TResult>(Func<TResult> function);
Task<TResult> InvokeAsync<TResult>(Func<TResult> workItem);
/// <summary>
/// Invokes the given <see cref="Func{TResult}"/> in the context of the associated <see cref="Renderer"/>.
/// </summary>
/// <param name="asyncFunction">The asynchronous function to execute.</param>
/// <param name="workItem">The asynchronous function to execute.</param>
/// <returns>A <see cref="Task{TResult}"/> that will be completed when the function has finished executing.</returns>
Task<TResult> InvokeAsync<TResult>(Func<Task<TResult>> asyncFunction);
Task<TResult> InvokeAsync<TResult>(Func<Task<TResult>> workItem);
}
}

View File

@ -1,10 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.RenderTree;
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Rendering;
namespace Microsoft.AspNetCore.Components
{
@ -48,13 +47,13 @@ namespace Microsoft.AspNetCore.Components
/// synchronization context.
/// </summary>
/// <param name="workItem">The work item to execute.</param>
public Task Invoke(Action workItem)
public Task InvokeAsync(Action workItem)
{
if (_renderer == null)
{
throw new InvalidOperationException("The render handle is not yet assigned.");
}
return _renderer.Invoke(workItem);
return _renderer.InvokeAsync(workItem);
}
/// <summary>

View File

@ -258,7 +258,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
/// synchronization context.
/// </summary>
/// <param name="workItem">The work item to execute.</param>
public virtual Task Invoke(Action workItem)
public virtual Task InvokeAsync(Action workItem)
{
// This is for example when we run on a system with a single thread, like WebAssembly.
if (_dispatcher == null)
@ -276,7 +276,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
else
{
return _dispatcher.Invoke(workItem);
return _dispatcher.InvokeAsync(workItem);
}
}

View File

@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
_state = state;
}
public Task Invoke(Action action)
public Task InvokeAsync(Action action)
{
var completion = new RendererSynchronizationTaskCompletionSource<Action, object>(action);
ExecuteSynchronouslyIfPossible((state) =>
@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
return completion.Task;
}
public Task<TResult> Invoke<TResult>(Func<TResult> function)
public Task<TResult> InvokeAsync<TResult>(Func<TResult> function)
{
var completion = new RendererSynchronizationTaskCompletionSource<Func<TResult>, TResult>(function);
ExecuteSynchronouslyIfPossible((state) =>

View File

@ -386,7 +386,7 @@ namespace Microsoft.AspNetCore.Components.Test
supplierParams.Add("Name", name);
}
renderer.Invoke(() => supplier.SetParametersAsync(ParameterCollection.FromDictionary(supplierParams)));
renderer.InvokeAsync((Action)(() => supplier.SetParametersAsync(ParameterCollection.FromDictionary(supplierParams))));
return supplier;
}

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Components.Test
public void DisplaysComponentInsideLayout()
{
// Arrange/Act
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(ComponentWithLayout) }
})));
@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Components.Test
public void DisplaysComponentInsideNestedLayout()
{
// Arrange/Act
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(ComponentWithNestedLayout) }
})));
@ -112,13 +112,13 @@ namespace Microsoft.AspNetCore.Components.Test
public void CanChangeDisplayedPageWithSameLayout()
{
// Arrange
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(ComponentWithLayout) }
})));
// Act
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(DifferentComponentWithLayout) }
})));
@ -163,13 +163,13 @@ namespace Microsoft.AspNetCore.Components.Test
public void CanChangeDisplayedPageWithDifferentLayout()
{
// Arrange
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(ComponentWithLayout) }
})));
// Act
_renderer.Invoke(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
_renderer.InvokeAsync(() => _pageDisplayComponent.SetParametersAsync(ParameterCollection.FromDictionary(new Dictionary<string, object>
{
{ nameof(PageDisplay.Page), typeof(ComponentWithNestedLayout) }
})));

View File

@ -2016,7 +2016,7 @@ namespace Microsoft.AspNetCore.Components.Test
// Act/Assert: If a disposed component requests a render, it's a no-op
var renderHandle = ((FakeComponent)childComponent3).RenderHandle;
renderHandle.Invoke(() => renderHandle.Render(builder
renderHandle.InvokeAsync(() => renderHandle.Render(builder
=> throw new NotImplementedException("Should not be invoked")));
Assert.Equal(2, renderer.Batches.Count);
}
@ -2905,7 +2905,7 @@ namespace Microsoft.AspNetCore.Components.Test
var asyncExceptionTcs = new TaskCompletionSource<object>();
taskToAwait = asyncExceptionTcs.Task;
await renderer.Invoke(component.TriggerRender);
await renderer.InvokeAsync(component.TriggerRender);
// Act
var exception = new InvalidOperationException();
@ -3409,7 +3409,7 @@ namespace Microsoft.AspNetCore.Components.Test
public void TriggerRender()
{
var t = _renderHandle.Invoke(() => _renderHandle.Render(_renderFragment));
var t = _renderHandle.InvokeAsync(() => _renderHandle.Render(_renderFragment));
// This should always be run synchronously
Assert.True(t.IsCompleted);
if (t.IsFaulted)
@ -3659,7 +3659,7 @@ namespace Microsoft.AspNetCore.Components.Test
{
foreach (var renderHandle in _renderHandles)
{
renderHandle.Invoke(() => renderHandle.Render(builder =>
renderHandle.InvokeAsync(() => renderHandle.Render(builder =>
{
builder.AddContent(0, $"Hello from {nameof(MultiRendererComponent)}");
}));
@ -3820,7 +3820,7 @@ namespace Microsoft.AspNetCore.Components.Test
return TriggerRenderAsync();
}
public Task TriggerRenderAsync() => _renderHandle.Invoke(() => _renderHandle.Render(RenderFragment));
public Task TriggerRenderAsync() => _renderHandle.InvokeAsync(() => _renderHandle.Render(RenderFragment));
}
private void AssertStream(int expectedId, (int id, NestedAsyncComponent.EventType @event)[] logStream)

View File

@ -403,7 +403,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_Void_CanRunSynchronously_WhenNotBusy()
public async Task InvokeAsync_Action_CanRunSynchronously_WhenNotBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -411,7 +411,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
Thread capturedThread = null;
// Act
var task = context.Invoke(() =>
var task = context.InvokeAsync(() =>
{
capturedThread = Thread.CurrentThread;
});
@ -422,7 +422,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_Void_CanRunAsynchronously_WhenBusy()
public async Task InvokeAsync_Action_CanRunAsynchronously_WhenBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -444,7 +444,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
Assert.True(e1.Wait(Timeout), "timeout");
var task2 = context.Invoke(() =>
var task2 = context.InvokeAsync(() =>
{
capturedThread = Thread.CurrentThread;
@ -462,32 +462,32 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_Void_CanRethrowExceptions()
public async Task InvokeAsync_Action_CanRethrowExceptions()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.Invoke(() =>
var task = context.InvokeAsync((Action)(() =>
{
throw new InvalidTimeZoneException();
});
}));
// Assert
await Assert.ThrowsAsync<InvalidTimeZoneException>(async () => await task);
}
[Fact]
public async Task Invoke_Void_CanReportCancellation()
public async Task InvokeAsync_Action_CanReportCancellation()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.Invoke(() =>
var task = context.InvokeAsync((Action)(() =>
{
throw new OperationCanceledException();
});
}));
// Assert
Assert.Equal(TaskStatus.Canceled, task.Status);
@ -495,14 +495,14 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_T_CanRunSynchronously_WhenNotBusy()
public async Task InvokeAsync_FuncT_CanRunSynchronously_WhenNotBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
var thread = Thread.CurrentThread;
// Act
var task = context.Invoke(() =>
var task = context.InvokeAsync(() =>
{
return Thread.CurrentThread;
});
@ -512,7 +512,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_T_CanRunAsynchronously_WhenBusy()
public async Task InvokeAsync_FuncT_CanRunAsynchronously_WhenBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
Assert.True(e1.Wait(Timeout), "timeout");
var task2 = context.Invoke(() =>
var task2 = context.InvokeAsync(() =>
{
e3.Set();
@ -550,32 +550,32 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task Invoke_T_CanRethrowExceptions()
public async Task InvokeAsync_FuncT_CanRethrowExceptions()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.Invoke<string>(() =>
var task = context.InvokeAsync<string>((Func<string>)(() =>
{
throw new InvalidTimeZoneException();
});
}));
// Assert
await Assert.ThrowsAsync<InvalidTimeZoneException>(async () => await task);
}
[Fact]
public async Task Invoke_T_CanReportCancellation()
public async Task InvokeAsync_FuncT_CanReportCancellation()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.Invoke<string>(() =>
var task = context.InvokeAsync<string>((Func<string>)(() =>
{
throw new OperationCanceledException();
});
}));
// Assert
Assert.Equal(TaskStatus.Canceled, task.Status);
@ -583,7 +583,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_Void_CanRunSynchronously_WhenNotBusy()
public async Task InvokeAsync_FuncTask_CanRunSynchronously_WhenNotBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -603,7 +603,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_Void_CanRunAsynchronously_WhenBusy()
public async Task InvokeAsync_FuncTask_CanRunAsynchronously_WhenBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -644,7 +644,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_Void_CanRethrowExceptions()
public async Task InvokeAsync_FuncTask_CanRethrowExceptions()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -660,7 +660,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_Void_CanReportCancellation()
public async Task InvokeAsync_FuncTask_CanReportCancellation()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -677,7 +677,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_T_CanRunSynchronously_WhenNotBusy()
public async Task InvokeAsync_FuncTaskT_CanRunSynchronously_WhenNotBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -694,7 +694,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_T_CanRunAsynchronously_WhenBusy()
public async Task InvokeAsync_FuncTaskT_CanRunAsynchronously_WhenBusy()
{
// Arrange
var context = new RendererSynchronizationContext();
@ -732,32 +732,32 @@ namespace Microsoft.AspNetCore.Components.Rendering
}
[Fact]
public async Task InvokeAsync_T_CanRethrowExceptions()
public async Task InvokeAsync_FuncTaskT_CanRethrowExceptions()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.InvokeAsync<string>(() =>
var task = context.InvokeAsync<string>((Func<Task<string>>)(() =>
{
throw new InvalidTimeZoneException();
});
}));
// Assert
await Assert.ThrowsAsync<InvalidTimeZoneException>(async () => await task);
}
[Fact]
public async Task InvokeAsync_T_CanReportCancellation()
public async Task InvokeAsync_FuncTaskT_CanReportCancellation()
{
// Arrange
var context = new RendererSynchronizationContext();
// Act
var task = context.InvokeAsync<string>(() =>
var task = context.InvokeAsync<string>((Func<Task<string>>)(() =>
{
throw new OperationCanceledException();
});
}));
// Assert
Assert.Equal(TaskStatus.Canceled, task.Status);

View File

@ -180,7 +180,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
try
{
await Renderer.Invoke(() =>
await Renderer.InvokeAsync(() =>
{
SetCurrentCircuitHost(this);
DotNetDispatcher.BeginInvoke(callId, assemblyName, methodIdentifier, dotNetObjectId, argsJson);

View File

@ -312,7 +312,7 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
public void TriggerRender()
{
var task = _renderHandle.Invoke(() => _renderHandle.Render(_renderFragment));
var task = _renderHandle.InvokeAsync(() => _renderHandle.Render(_renderFragment));
Assert.True(task.IsCompletedSuccessfully);
}
}
@ -341,7 +341,7 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
public void TriggerRender()
{
var task = _renderHandle.Invoke(() => _renderHandle.Render(Content));
var task = _renderHandle.InvokeAsync(() => _renderHandle.Render(Content));
Assert.True(task.IsCompletedSuccessfully);
}
}

View File

@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers
// We do it this way so that we don't have to be doing renderer.Invoke on each and every test.
public void TriggerRender()
{
var t = _renderHandle.Invoke(() => _renderHandle.Render(BuildRenderTree));
var t = _renderHandle.InvokeAsync(() => _renderHandle.Render(BuildRenderTree));
// This should always be run synchronously
Assert.True(t.IsCompleted);
if (t.IsFaulted)

View File

@ -27,7 +27,7 @@
async Task RunWithDispatch()
{
await Task.Delay(1).ConfigureAwait(false);
await Invoke(AttemptToRender);
await InvokeAsync(AttemptToRender);
// So we can observe that the dispatched work item completed by now
if (result == "Success")
@ -39,7 +39,7 @@
async Task RunWithDoubleDispatch()
{
await Task.Delay(1).ConfigureAwait(false);
await InvokeAsync(() => Invoke(AttemptToRender));
await InvokeAsync(() => InvokeAsync(AttemptToRender));
// So we can observe that the dispatched work item completed by now
if (result == "Success")