question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mono.Cecil does not set the HasFieldRVA field on a FieldDefinition when the InitialData property is set to non-null

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jbevaincommented, Mar 13, 2021

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?

0reactions
jkoritzinskycommented, Mar 15, 2021

Yes, I’ll send a PR with a targeted test and fix.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found