diff options
Diffstat (limited to 'src/IML/Context.cs')
| -rw-r--r-- | src/IML/Context.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/IML/Context.cs b/src/IML/Context.cs index fb103580..7c34745d 100644 --- a/src/IML/Context.cs +++ b/src/IML/Context.cs @@ -68,8 +68,13 @@ namespace Crow.IML il.DeclareLocal (typeof (GraphicObject)); il.Emit (OpCodes.Nop); - //set local GraphicObject to root object - il.Emit (OpCodes.Newobj, rootType.GetConstructors () [0]); + //set local GraphicObject to root object + ConstructorInfo ci = rootType.GetConstructor ( + BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, + null, Type.EmptyTypes, null); + if (ci == null) + throw new Exception ("No default parameterless constructor found in " + rootType.Name); + il.Emit (OpCodes.Newobj, ci); il.Emit (OpCodes.Stloc_0); CompilerServices.emitSetCurInterface (il); } |