Fixed - Aspect: assigning an event from an aspect results in overload not found error

The code to reproduce: Module 1.bugreport.zip (1.4 MB)

The build log: Module 1.bugreport.txt (32.3 KB)

When you wire an event from an aspect, it looks for a method with 0 parameters (that does not exist), causing the error

No overloaded method "MyEventHandler" with 0 parameters on type "Test"

Followed by the hint:

 Best matching overload is "MyEventHandler(p: String)"

The one mentioned in the hint IS the one that was assigned as eventhandler.

Update:

When you change the code in program.vb - remove the parameter on the event and on the method in class Test, the error changes in:

Cannot get address of value

Thanks, logged as bugs://85255

The aspect itself isn’t in this zip file.

bugs://85255 got closed with status testcaseerr.

Test project with the aspect: Aspectproblem.zip (2.1 MB)

bugs://85255 got reopened.

bugs://85255 got closed with status fixed.

@Theo69:

try this:
b.Add(new StandaloneStatement(new ProcValue(new SelfValue, evt.AddMethod, new ProcPtrValue(new SelfValue, aMethod.Name))))

UnaryValue tries to actually take the address of the pointer, while ProcPtr does do what you want.

1 Like