Fix metadata version not populated, breaking all past versions#515
Merged
SamboyCoding merged 1 commit intoSamboyCoding:developmentfrom Feb 14, 2026
Merged
Fix metadata version not populated, breaking all past versions#515SamboyCoding merged 1 commit intoSamboyCoding:developmentfrom
SamboyCoding merged 1 commit intoSamboyCoding:developmentfrom
Conversation
SamboyCoding
approved these changes
Feb 14, 2026
Pull Request Test Coverage Report for Build 22017229224Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed a regression in CPP2IL 2022.1.0 #20 where it can't find the codereg address for my Nintendo Switch binary with Unity 2019.4.27, while the previous milestone 2022.1.0 #19 did.
I further narrowed down the regression to AssetRipper/AssetRipper@1.1.8...1.1.9.
When I diffed the code, I came across this issue:
Commit c91170a changed
ReadableClassversion checking from using the global staticLibCpp2IlMain.MetadataVersionto using an instance propertyMetadataVersion. The instance property is set from the binary reader'sMetadataVersionwhen the struct is created inInternalReadReadableClass<T>().However,
Il2CppBinary._metadataVersionis only set inInit(), which runs afterFindCodeAndMetadataReg(). So during code registration search, the binary'sMetadataVersionis 0 (default), causing all version-gated fields to be read incorrectly. This likely breaks all past (non-current) metadata versions.To fix, I added the missing setter call, and reworked
FindCodeAndMetadataReg()to raise an exception in case this ever happens again.@ds5678 tagging for visibility as this probably has a pretty big impact on AssetRipper.