According to Marek, Mono requires the PropertyMap table to be sorted.

This commit is contained in:
jfrijters 2010-12-09 06:12:19 +00:00
Родитель 6395aaffb6
Коммит af092c964f
3 изменённых файлов: 39 добавлений и 21 удалений

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

@ -264,10 +264,12 @@ namespace IKVM.Reflection.Emit
foreach (ModuleBuilder moduleBuilder in modules)
{
if (string.Compare(moduleBuilder.fileName, assemblyFileName, StringComparison.OrdinalIgnoreCase) == 0)
moduleBuilder.PopulatePropertyAndEventTables();
if (manifestModule == null
&& string.Compare(moduleBuilder.fileName, assemblyFileName, StringComparison.OrdinalIgnoreCase) == 0)
{
manifestModule = moduleBuilder;
break;
}
}

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

@ -113,6 +113,17 @@ namespace IKVM.Reflection.Emit
types.Add(moduleType);
}
internal void PopulatePropertyAndEventTables()
{
// LAMESPEC the PropertyMap and EventMap tables are not required to be sorted by the CLI spec,
// but .NET sorts them and Mono requires them to be sorted, so we have to populate the
// tables in the right order
foreach (TypeBuilder type in types)
{
type.PopulatePropertyAndEventTables();
}
}
internal void WriteTypeDefTable(MetadataWriter mw)
{
int fieldList = 1;
@ -1176,6 +1187,7 @@ namespace IKVM.Reflection.Emit
public void __Save(PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
{
PopulatePropertyAndEventTables();
IList<CustomAttributeData> attributes = asm.GetCustomAttributesData(null);
if (attributes.Count > 0)
{

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

@ -658,6 +658,29 @@ namespace IKVM.Reflection.Emit
{
mb.Bake();
}
if (declarativeSecurity != null)
{
this.ModuleBuilder.AddDeclarativeSecurity(token, declarativeSecurity);
}
if (baseType != null)
{
extends = this.ModuleBuilder.GetTypeToken(baseType).Token;
}
if (interfaces != null)
{
foreach (Type interfaceType in interfaces)
{
InterfaceImplTable.Record rec = new InterfaceImplTable.Record();
rec.Class = token;
rec.Interface = this.ModuleBuilder.GetTypeToken(interfaceType).Token;
this.ModuleBuilder.InterfaceImpl.AddRecord(rec);
}
}
return new BakedType(this);
}
internal void PopulatePropertyAndEventTables()
{
if (properties != null)
{
PropertyMapTable.Record rec = new PropertyMapTable.Record();
@ -680,25 +703,6 @@ namespace IKVM.Reflection.Emit
eb.Bake();
}
}
if (declarativeSecurity != null)
{
this.ModuleBuilder.AddDeclarativeSecurity(token, declarativeSecurity);
}
if (baseType != null)
{
extends = this.ModuleBuilder.GetTypeToken(baseType).Token;
}
if (interfaces != null)
{
foreach (Type interfaceType in interfaces)
{
InterfaceImplTable.Record rec = new InterfaceImplTable.Record();
rec.Class = token;
rec.Interface = this.ModuleBuilder.GetTypeToken(interfaceType).Token;
this.ModuleBuilder.InterfaceImpl.AddRecord(rec);
}
}
return new BakedType(this);
}
public override Type BaseType