Invalid Metadata generated when changing visibility of nested Type #83
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Consdering the following code (global namespace) compiled into an assembly:
When reading the assembly, changing the visibility of Nested to "public" via:
writing out the assembly and attempting to load it, a BadImageFormatException with the following message is generated: "TypeDef is not marked Nested but has an enclosing type."
Roundtripping the assembly without touching the visibility of the Nested type does not yield this error. Tools such as ILSpy have their problems with the generated assembly (Nested is shown twice, once as a namespace-level class and once as nested). I assume its an error in the generation of metadata.
The full code used to reproduce the issue (Compile as C# console app, add cecil via nuget):
Can be closed: One needs to use IsNestedPublic vs. IsPublic.
:)