Profiling Windows Forms async event handlers
mhiltunen
Posts: 2 Bronze 1
Is there a way to profile async event handlers. For example if I have a code like this:
If I profile the app using Line-level & method-level timings this is what I get:
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?
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:
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?