castleproject / Core

Castle Core, including Castle DynamicProxy, Logging Services and DictionaryAdapter
http://www.castleproject.org/
Other
2.2k stars 468 forks source link

Async BeforeInvoke not complete before decorated method start? #611

Closed htzhang2 closed 2 years ago

htzhang2 commented 2 years ago

Here is my interceptor and BeforeInvoke:

public class MyInterceptor : IMethodInterceptor { public override async void BeforeInvoke(InvocationContext invocationContext) { // Expect this to be completed before decorated method starts await [before_method].ConfigureAwait(false); } }

[MyAttribute] public async Task DecoratedMethod() { // Expect the following method to start after [before_method] completes await [real_method].ConfigureAwait(false); }

Expected: [before_method] completes before [real_method]

Actual: [real_method] starts before [before_method] complete

Library: https://github.com/f135ta/SimpleProxy Castle.Core (4.4.1) Castle.Core.AsyncInterceptor (2.0.0)

jonorossi commented 2 years ago

This is Castle DynamicProxy, you'll need to ask your SimpleProxy question on that project.

Looks like SimpleProxy is built on Castle DynamicProxy, if there is a problem with DP, you'll need to provide code using DP directly.