Profiling Windows Forms async event handlers

mhiltunenmhiltunen Posts: 2
edited December 2, 2014 6:42AM in ANTS Performance Profiler 9
Is there a way to profile async event handlers. For example if I have a code like this:
    Private Async Sub ChildForm_Load(sender As Object, e As EventArgs) Handles Me.Load

        Await Task.Run(Sub()
                           Me.WaitThreeSeconds()
                       End Sub)

        Me.WaitTwoSeconds()
        Me.Close()
    End Sub


    Public Sub WaitThreeSeconds()
        Threading.Thread.Sleep(3000)
    End Sub

    Public Sub WaitTwoSeconds()
        Threading.Thread.Sleep(2000)
    End Sub

If I profile the app using Line-level & method-level timings this is what I get:

ayr09h.png

Inside ChildForm_Load all I can see is .NET StateMachine's MoveNext-method, but I can't see anything from the actual form load. Am I doing something wrong here or is there a way to see the actual performance inside async event handlers?
Sign In or Register to comment.