Closed eugene-chehovskoy closed 8 years ago
Interesting. The approach taken in the article is probably not so far from the truth. I will take a look at it and see if there is something there that can be provided as helper classes in LightInject.Interception
Some more links I've found how it works in other libraries: https://snipt.net/raw/33a8f602a9126cb0dd782ea94103383e/?nice https://github.com/ninject/Ninject.Extensions.Interception/blob/master/src/Ninject.Extensions.Interception/AsyncInterceptor.cs http://blog.cincura.net/233489-injecting-logging-into-asynchronous-methods/ http://stackoverflow.com/questions/28099669/intercept-async-method-that-returns-generic-task-via-dynamicproxy http://stackoverflow.com/questions/13630548/making-ninject-interceptors-work-with-async-methods
Any update on this problem?
We faced with this problem in our project also, we need to intercept async methods, but seems like LightInject doesn't support this. I'm personally like to use LIghtInject and don't want to switch to something else, but at this point it is crucial for us to use proxy/interception feature and because we intensively using async\await we need it to be supported.
So, @seesharper , do you have any plans to implement this feature ?
In progress right now
LightInject.Interception v1.2.0 published to the official NuGet feed
http://www.lightinject.net/interception/#asynchronous-interceptors
Hello,
I have repository with async methods and a want to create logging interceptor. The problem is that catch block doesn't fire because of async method and I can't await invovationInfo.Proceed() inside Invoke method:
So the question is: how to work with async method inside interceptor and how to use the same interceptor with async and non-async methods?
P.S. I've found this https://msdn.microsoft.com/en-us/magazine/dn574805.aspx article about intercepting asynchronous methods using Unity, but it looks quite complicated and how to use this approach with LightInject?