Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions MetadataProvider/AssemblyExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ private void ExtractField(SRM.FieldDefinitionHandle handle)
field.Visibility = GetVisibilityKind(fielddef.Attributes);
field.Value = ExtractFieldDefaultValue(fielddef);

field.SpecifiesRelativeVirtualAddress = fielddef.Attributes.HasFlag(SR.FieldAttributes.HasFieldRVA);
if (field.SpecifiesRelativeVirtualAddress)
{
var fieldDataReader = reader.GetSectionData(fielddef.GetRelativeVirtualAddress()).GetReader();
var fieldData = fieldDataReader.ReadBytes(fieldDataReader.Length);
field.Value = new Constant(fieldData)
{
Type = new ArrayType(PlatformTypes.Byte)
};
}

currentType.Fields.Add(field);
}

Expand Down
2 changes: 1 addition & 1 deletion Model/Types/TypeDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class FieldDefinition : ITypeMemberDefinition, IFieldReference
public Constant Value { get; set; }

public bool IsStatic { get; set; }

public bool SpecifiesRelativeVirtualAddress { get; set; }
public FieldDefinition(string name, IType type)
{
this.Name = name;
Expand Down