In my application I use this tecnique to check how many milliseconds a specific task requires:
Private sub Test()
Dim watch as StopWatch
dim Method as System.Reflection.MethodBase = System.Reflection.MethodBase.GetCurrentMethod
watch.Start
' perform the heavy task I need to measure
watch.stop
SaveResult(watch.ElapsedMilliseconds, Method.IsSTA ??? )
End sub
My question: is there a way to detect if that method is running on UI thread or it has been called with Task.Run?
In the pseudo-code above, Method.IsSTA would be the option to get that information
"SaveResult" method has to receive info about if the method ran on main thread or not.
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire