Framework-Class-Library-Extension icon indicating copy to clipboard operation
Framework-Class-Library-Extension copied to clipboard

InitializeEventHandlers aspect with events defined in interfaces

Open Whathecode opened this issue 10 years ago • 0 comments

When there is an interface which defines an event within the assembly targeted by the InitializeEventHandlers aspect, compilation fails.

Unhandled exception (4.0.34.0, 32 bit, CLR 4.5, Release): System.NullReferenceException: Object reference not set to an instance of an object. at PostSharp.Sdk.AspectInfrastructure.TypeInitializationManager.^nCElfVTrtpDd.^Dpi1V+WW(MethodDefDeclaration _0) ...

A current workaround is to exclude the particular event in question by using [InitializeEventHandlers( AttributeExclude = true)]. This does not seem the aspect from being applied to implementing classes.

Whathecode avatar Apr 19 '15 11:04 Whathecode