Find the exceptions thrown by Microsoft.FSharp.Control.Trampoline

I am responsible for the F # WPF application . He sends me an email when an unhandled exception occurs. In most cases, I can determine the source of the exception from the error message and the stack trace. However, I sometimes get a message like the following that does not include any of my code in the stack trace.

Summary:
Object reference not set to an instance of an object.
--------------
Details:

System.NullReferenceException: 
Object reference not set to an instance of an object.
   at Microsoft.FSharp.Control.CancellationTokenOps.Start@1234-1.Invoke(Exception e)
   at <StartupCode$FSharp-Core>.$Control.loop@435-40(Trampoline this, FSharpFunc`2 action)
   at Microsoft.FSharp.Control.Trampoline.ExecuteAction(FSharpFunc`2 firstAction)
   at Microsoft.FSharp.Control.TrampolineHolder.Protect(FSharpFunc`2 firstAction)
   at <StartupCode$FSharp-Core>.$Control.-ctor@520-1.Invoke(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

What keys are available on this stack trace that can help me identify the source of this exception?

, , async. ( F #). NullReferenceException - async? , Start(). ? Start() Exception, , , . - ? , - Microsoft.FSharp.Control.Trampoline, .

, InnerExceptions AggregateExceptions. , , Exception, .

+4
1

. .

[<EntryPoint>]
let main argv = 

    async { printfn "Inside async block."
            let o = null
            o.GetType() |> ignore
    } |> Async.Start

    System.Console.ReadKey(true) |> ignore
    0 // return an integer exit code

:

  • .
  • .
  • - (, Async.Catch) , .
+4

Source: https://habr.com/ru/post/1628550/


All Articles