Blazor Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation错误,会发生什么情况?
我们在使用Blazor和AmChart4方面都是新手。 我们每隔几秒钟就向系列中添加一次数据,我们希望让应用程序运行几个小时 通常在运行几个小时后,我们会出现以下异常: 一项任务被取消。在Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](字符串标识符,对象[]args) 位于Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime,字符串标识符,对象[]args) 在D:\ProgettiBlazor\amCharts\u V3\amCharts\Pages\Index.CountDownTimer(对象源,ElapsedEventArgs e)中的amCharts.Pages.Index.CountDownTimer处:第97行 有人对如何预防这个问题有什么建议吗 在File.blazor中,有一个线程每5秒运行一次,调用此函数: ''' ''' 根据文件js,我们有: ''' 函数AggiungiPunti_Random(){ } ''' 其中generate data random创建了一个带有日期和少量值的对象Blazor Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation错误,会发生什么情况?,blazor,amcharts4,Blazor,Amcharts4,我们在使用Blazor和AmChart4方面都是新手。 我们每隔几秒钟就向系列中添加一次数据,我们希望让应用程序运行几个小时 通常在运行几个小时后,我们会出现以下异常: 一项任务被取消。在Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](字符串标识符,对象[]args) 位于Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRunti
public async void CountDownTimer(Object source, System.Timers.ElapsedEventArgs e)
{
try
{
counter += 1;
writeLog(string.Format("CountDownTimer {0} ", counter));
await JS.InvokeVoidAsync("AggiungiPunti_Random");
await InvokeAsync(StateHasChanged);
}
catch (Exception ex)
{
writeLog(string.Format("CountDownTimer - eccezione: {0} {1}", ex.Message, ex.StackTrace));
}
}
am4core.ready(function () {
var dati = generateChartData_Random(new Date());
chart.addData(dati);
});