fix(vendor/msgpack-cs): fix formatter struct serialization and added Enum formatter#6
Merged
prikolium-cfx merged 3 commits intocitizenfx:masterfrom Jun 23, 2025
Merged
Conversation
…flags This commit fixes a weird use case where sometimes Enums with or without Flags attribute were serialized using the Type formatter causing a IL crash. Works both clientside and serverside.
prikolium-cfx
approved these changes
Jun 23, 2025
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.
GOAL OF THIS PR
This fix addresses a bug in struct serialization where its parameters were being addressed as values and not as references generating a IL exception.
NOTE: this fix works only server-side, as long as client-side uses the previously added patch. Once that client-side will be allowed to use formatters this patch will automatically apply.
Before:

After:

Edit 2025-06-18: Added a dedicated formatter for enums to fix a rare edge case where enum fields inside structs were incorrectly serialized as structs themselves instead of their enum type. This also ensures correct handling of enums marked with the [Flags] attribute.