Added "RuntimeCompatibilityAttribute(WrapNonExceptionThrows = true)" to generated assemblies.

This commit is contained in:
jfrijters 2009-06-18 06:14:55 +00:00
Родитель f6a22f068f
Коммит 99c7df5de9
3 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -222,6 +222,7 @@ namespace IKVM.Internal
CustomAttributeBuilder debugAttr = new CustomAttributeBuilder(typeof(DebuggableAttribute).GetConstructor(new Type[] { typeof(bool), typeof(bool) }), new object[] { true, this.EmitDebugInfo });
assemblyBuilder.SetCustomAttribute(debugAttr);
}
AttributeHelper.SetRuntimeCompatibilityAttribute(assemblyBuilder);
if(Environment.Version.Major == 4 && Environment.Version.Minor == 0 && Environment.Version.Build == 20506)
{
// FXBUG workaround for MethodImpl bug in .NET 4.0 beta 1

Просмотреть файл

@ -26,7 +26,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
#if IKVM_REF_EMIT
using IKVM.Reflection.Emit;
#else
@ -458,10 +457,7 @@ namespace IKVM.Internal
#else
AppDomain.CurrentDomain.DefineDynamicAssembly(name, access, null, null, null, null, null, true, attribs);
#endif
assemblyBuilder.SetCustomAttribute(new CustomAttributeBuilder(
typeof(RuntimeCompatibilityAttribute).GetConstructor(Type.EmptyTypes), new object[0],
new PropertyInfo[] { typeof(RuntimeCompatibilityAttribute).GetProperty("WrapNonExceptionThrows") }, new object[] { true },
new FieldInfo[0], new object[0]));
AttributeHelper.SetRuntimeCompatibilityAttribute(assemblyBuilder);
bool debug = System.Diagnostics.Debugger.IsAttached;
CustomAttributeBuilder debugAttr = new CustomAttributeBuilder(typeof(DebuggableAttribute).GetConstructor(new Type[] { typeof(bool), typeof(bool) }), new object[] { true, debug });
assemblyBuilder.SetCustomAttribute(debugAttr);

Просмотреть файл

@ -1849,6 +1849,15 @@ namespace IKVM.Internal
field.SetCustomAttribute(constantValueAttrib);
}
#endif // STATIC_COMPILER && !COMPACT_FRAMEWORK
internal static void SetRuntimeCompatibilityAttribute(AssemblyBuilder assemblyBuilder)
{
Type runtimeCompatibilityAttribute = typeof(System.Runtime.CompilerServices.RuntimeCompatibilityAttribute);
assemblyBuilder.SetCustomAttribute(new CustomAttributeBuilder(
runtimeCompatibilityAttribute.GetConstructor(Type.EmptyTypes), new object[0],
new PropertyInfo[] { runtimeCompatibilityAttribute.GetProperty("WrapNonExceptionThrows") }, new object[] { true },
new FieldInfo[0], new object[0]));
}
}
#if !COMPACT_FRAMEWORK