winforms - How to determine if method is async at runtime -


I have a legacy project in which there are hundreds of method signatures for Winforms events. Obviously I do not want to go now and BeginInvoke / EndInvoke does not work because it will cause UI cross threading issues.

Although I need to be able to mark these signatures (due to deadlock) async to control some async commands which we have to be able to do any other than deadlock No result.

I can successfully call the event with the BulinWoke and it works perfectly and it works correctly. However, it breaks into another thread and breaks the old implementation which we do not want to go through and to make async and to make conscious.

Then I was checking to use the incident. GetInvokationList () and looping through and calling each to separate. If the method was async, start the start / end. Otherwise call it directly on the UI thread.

My only problem is that I can not find a way through reflection that it shows whether the method sign is async or not.

Anyone know how to find a method async or not something from MethodInfo or GetInvokationList () values?

Thank you!

If you are using .NET 4.5, try "asyncstatemachine attribute".

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -