-
-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mono.Cecil does not set the HasFieldRVA field on a FieldDefinition when the InitialData property is set to non-null #728
Comments
Hi @jkoritzinsky, Thank you for filing this. That definitely sounds like a bug, which might be annoying because from a quick look that should not happen: https://github.com/jbevain/cecil/blob/master/Mono.Cecil/FieldDefinition.cs#L114 Any chance you could start a PR with a failing test? |
I'll work on putting together a failing unit test for this. |
While putting together a unit test, I found the issue. When a new field is created in Mono.Cecil and an array is assigned to the When I manually set the It would be nice if the |
Hah! That makes sense. Yes we should do that, should be has simple as: public byte [] InitialValue {
// get
set {
initial_value = value;
rva = 0;
HasFieldRVA = !value.IsNullOrEmpty();
}
} @jkoritzinsky want to send a PR with the test & the fix? |
Yes, I'll send a PR with a targeted test and fix. |
* Implement automatic handling of the HasFieldRVA field attribute. Fixes #728 * Add FieldDefinition.HasFieldRVA Co-authored-by: Jb Evain <jb@evain.net>
I'm trying to use the
FieldDefinition.InitialData
property to emit a static array into an image using the.data
declaration feature in ECMA-335.However, it seems that any data assigned to this field is dropped and not emitted as a
.data
declaration in the image.I know that Mono.Cecil supports round-tripping the
InitialData
field from a loaded assembly back to disk if it hasn't been modified, but it seems that modifying it or assigning it on a new field is unsupported.The text was updated successfully, but these errors were encountered: