diff --git a/reflect/Emit/ModuleBuilder.cs b/reflect/Emit/ModuleBuilder.cs index e22080b9..d8d56cec 100644 --- a/reflect/Emit/ModuleBuilder.cs +++ b/reflect/Emit/ModuleBuilder.cs @@ -398,6 +398,11 @@ namespace IKVM.Reflection.Emit bb.WriteCompressedInt(list.Count); foreach (CustomAttributeBuilder cab in list) { + if (cab.Constructor.Module != this) + { + // to make ildasm show the type properly, we need to have a TypeRef to the type + ImportType(cab.Constructor.DeclaringType); + } bb.Write(cab.Constructor.DeclaringType.AssemblyQualifiedName); namedArgs.Clear(); cab.WriteNamedArgumentsForDeclSecurity(this, namedArgs);