Mono.Cecil does not set the HasFieldRVA field on a FieldDefinition when the InitialData property is set to non-null
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to get Initial Value of Field by Mono Cecil?
I am not sure Cecil provides an API to retrieve this information but since instance fields are initialized at the type's constructor and ......
Read more >[SOLVED] Burst and Mono Cecil
There is a Unity limitation that I'm not seeing here and I'm wondering if there is a hidden way to achieve what I...
Read more >How can I set an initial value of a new field?
I'd like to create a new field in a class and it should have an initial value. I'm thinking of something like this...
Read more >Mono Cecil has errors when trying to download
If I try to enter the git url in package manager, I get errors that say access was denied.
Read more >Mono Cecil
The mono cecil library from https://www.nuget.org/packages/Mono. ... These package versions might not be safe to use in production with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 https://github.com/jbevain/cecil/blob/master/Mono.Cecil/AssemblyWriter.cs#L1595
Any chance you could start a PR with a failing test?
Yes, I’ll send a PR with a targeted test and fix.