<= Home

Using Encase with .NET 2.0 Framework

Posted about over 2 years ago

If you are using the Encase AOP framework with the 2.0 Framework there is a known bug. An AmbiguousMethodException will be thrown from the following line of code in the MixinMethodManufacturer Class:


il.Emit(OpCodes.Call, typeof(MethodBase).GetMethod("GetMethodFromHandle"));
 
To resolve this issue, replace that line with the following lines:
 
object[] parameterTypes = new object() {  typeof(RuntimeMethodHandle) } ;
typeof(MethodBase).GetMethod("GetMethodFromHandle", parameterTypes) ; //Changed

 
This is because the a new method overload for GetMethodFromHandle now exists in the 2.0 Framework. The new code specifies the correct method Encase uses to mixin other instances into a class. This fix applies to Encase version 0.7. Future releases will resolve this.