-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"base" equals "this" in overriden method #42
Comments
Thanks for the report, potentially there might be other side-effects with around aspects and virtual functions. We will analyze all possible issues to provide a reliable solution. |
I was not able to reproduce StackOverflow issue using a simple example:
I'm a getting correct result when executing this code, though there are some redundant "override" attributes on generated methods which doesn't have corresponding virtual functions in the parent class. That should be fixed, but currently I have no idea how that can lead to the stack overflow issue. As for base.GetType() == this.GetType() - this condition will always return true, regardless of AspectInjector, because GetType() returns the exact runtime type of the current instance. Since both "base" and "this" belong to the same instance, the call will return the same type in both cases. Can you provide more details about .NET framework version and which runtime you are using (Microsoft .NET, Mono)? |
You need to add [Aspect(typeof(TraceAspect))] to Parent class too to get the exception. (Microsoft .NET 4.5.2) |
I have found the root cause, will publish a fix by tomorrow |
Fixed in 1.0.0-beta4 |
I have two classes: Base and Child. There is a method in Base that's overriden in Child and that has an Around aspect. Overriden method calls base implementation, but it calls himself instead resulting in StackOverflow exception.
base.GetType() == this.GetType()
returnstrue
The text was updated successfully, but these errors were encountered: