JakeRadMSFT/ExampleNotebooks

Exception when running this example in Visual Studio 2022

Opened this issue · 1 comments

System.AggregateException: One or more errors occurred. (A task was canceled.)
---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Submission#4.<>d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Submission#4.()
at Submission#4.(Object[] submissionArray)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray1 precedingExecutors, Func2 currentExecutor, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.CodeAnalysis.Scripting.Script1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray1 precedingExecutors, Func2 currentExecutor, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script1.RunFromAsync(ScriptState previousState, Func2 catchException, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.ScriptState.ContinueWithAsync(String code, ScriptOptions options, Func2 catchException, CancellationToken cancellationToken) at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.RunAsync(String code, CancellationToken cancellationToken, Func2 catchException) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.CSharp\CSharpKernel.cs:line 354
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.RunAsync(String code, CancellationToken cancellationToken, Func2 catchException) at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.HandleAsync(SubmitCode submitCode, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.CSharp\CSharpKernel.cs:line 256 at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.HandleAsync(SubmitCode submitCode, KernelInvocationContext context) at Microsoft.DotNet.Interactive.Kernel.<>c__DisplayClass72_01.b__0(KernelCommand _, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 689
at Microsoft.DotNet.Interactive.Commands.KernelCommand.InvokeAsync(KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Commands\KernelCommand.cs:line 56
at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 255
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 57
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<b__3>d.MoveNext() in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 72
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.b__3(KernelCommand cmd2, KernelInvocationContext ctx2)
at Microsoft.DotNet.Interactive.CompositeKernel.LoadExtensions(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 151
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.CompositeKernel.LoadExtensions(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<g__Combine|2>d.MoveNext() in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 70
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.g__Combine|2(KernelCommand cmd1, KernelInvocationContext ctx1, KernelPipelineContinuation next)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 42
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context)
at Microsoft.DotNet.Interactive.CompositeKernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 236
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.CompositeKernel.HandleAsync(KernelCommand command, KernelInvocationContext context)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 57
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 42
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context)
at Microsoft.DotNet.Interactive.Kernel.InvokePipelineAndCommandHandler(KernelCommand command) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 449
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.DotNet.Interactive.Kernel.InvokePipelineAndCommandHandler(KernelCommand command)
at Microsoft.DotNet.Interactive.KernelScheduler2.ScheduledOperation.ExecuteAsync() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelScheduler.cs:line 260 at Microsoft.DotNet.Interactive.KernelScheduler2.Run(ScheduledOperation operation) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelScheduler.cs:line 123
at Microsoft.DotNet.Interactive.KernelScheduler2.RunScheduledOperationAndDeferredOperations(ScheduledOperation operation) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelScheduler.cs:line 168 at Microsoft.DotNet.Interactive.KernelScheduler2.<>c__DisplayClass10_0.b__0(Object _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelScheduler.cs:line 98
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at Microsoft.DotNet.Interactive.KernelScheduler`2.ScheduledOperationRunLoop(Object _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelScheduler.cs:line 96
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
--- End of stack trace from previous location ---

--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Submission#4.<>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func2 catchExceptionOpt, CancellationToken cancellationToken)
image

This is time-out exception, we will wrap it so as to make experiment end nicely when times up