Skip to content

Relax Validation on Final Nested Type Ordering #625

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

Merged
merged 3 commits into from
May 10, 2025

Conversation

Washi1337
Copy link
Owner

ECMA-335 II.2 states TypeDefs should be sorted based on nested class relationships. That is, every enclosing class should be defined before its nested types in the TypeDef table. However, from empirical testing, CLR, CoreCLR and Mono do not actually implement checks for this, allowing for nested classes to be defined before their enclosing types.

This PR relaxes the NestedClass validation in AsmResolver to a non-fatal exception that can be ignored at rebuild time, to allow for typedef tokens to be preserved even if that results in nested classes being ordered incorrectly according to spec.

This PR also ensures the <Module> type is always assigned a RID of 1 when creating a new module.

Closes #545

@Washi1337 Washi1337 added bug dotnet Issues related to AsmResolver.DotNet labels May 4, 2025
@Washi1337 Washi1337 added this to the 6.0.0 milestone May 4, 2025

This comment has been minimized.

This comment has been minimized.

@Washi1337 Washi1337 merged commit 26232de into development May 10, 2025
16 checks passed
@Washi1337 Washi1337 deleted the feature/allow-unsorted-nested-typedefs branch May 10, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dotnet Issues related to AsmResolver.DotNet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant