timcassell / ProtoPromise

Robust and efficient library for management of asynchronous operations in C#/.Net.
MIT License
147 stars 13 forks source link

Preserve causality trace #269

Closed timcassell closed 11 months ago

timcassell commented 11 months ago

when progress callback is invoked synchronously.

Master:

Proto.Promises.Internal+UnhandledExceptionInternal : An exception was not handled. -- This exception's Stacktrace contains the causality trace of all async callbacks that ran.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
  Stack Trace:
     at ProtoPromiseTests.APIs.ProgressTests.ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void(SynchronizationOption synchronizationOption, Boolean forceAsync) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1839

--TearDown

--NullReferenceException
   at ProtoPromiseTests.APIs.ProgressTests.<>c.<ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void>b__75_1(Single v) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1830
   at Proto.Promises.Internal.PromiseRefBase.CallbackHelperVoid.InvokeAndCatchProgress[TProgress](TProgress& progress, Single value, ITraceable traceable) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Core\Promises\Internal\CallbackHelperInternal.cs:line 1552

PR:

Proto.Promises.Internal+UnhandledExceptionInternal : An exception was not handled. -- This exception's Stacktrace contains the causality trace of all async callbacks that ran.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
  Stack Trace:
     at ProtoPromiseTests.APIs.ProgressTests.ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void(SynchronizationOption synchronizationOption, Boolean forceAsync) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1840

--TearDown
   at ProtoPromiseTests.APIs.ProgressTests.<>c__DisplayClass75_0.<ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void>b__0() in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1828

   at ProtoPromiseTests.APIs.ProgressTests.ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void(SynchronizationOption synchronizationOption, Boolean forceAsync) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1824

   at NUnit.Framework.Internal.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)

   at NUnit.Framework.Internal.MethodWrapper.Invoke(Object fixture, Object[] args)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.InvokeTestMethod(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()

   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.Execute(TestExecutionContext context)

   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()

   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)

   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)

   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work, ParallelExecutionStrategy strategy)

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work)

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work, ParallelExecutionStrategy strategy)

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work)

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc()

   at System.Threading.Thread.StartHelper.Callback(Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.Thread.StartCallback()

   at ProtoPromiseTests.APIs.ProgressTests.ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void(SynchronizationOption synchronizationOption, Boolean forceAsync) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1824

   at NUnit.Framework.Internal.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)

   at NUnit.Framework.Internal.MethodWrapper.Invoke(Object fixture, Object[] args)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.InvokeTestMethod(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)

   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()

   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.Execute(TestExecutionContext context)

   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()

   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)

   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)

   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work, ParallelExecutionStrategy strategy)

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work)

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work, ParallelExecutionStrategy strategy)

   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work)

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()

   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()

   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()

   at NUnit.Framework.Internal.Execution.WorkItem.Execute()

   at NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc()

   at System.Threading.Thread.StartHelper.Callback(Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.Thread.StartCallback()

--NullReferenceException
   at ProtoPromiseTests.APIs.ProgressTests.<>c.<ProgressChainSubscribedWillBeInvokedInOrder_Resolved_void>b__75_1(Single v) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Tests\CoreTests\APIs\ProgressTests.cs:line 1830
   at Proto.Promises.Internal.PromiseRefBase.CallbackHelperVoid.InvokeAndCatchProgress[TProgress](TProgress& progress, Single value) in C:\Users\Tim\Documents\git\ProtoPromise\Package\Core\Promises\Internal\CallbackHelperInternal.cs:line 1549