Skip to content

fix(vendor/msgpack-cs): fix formatter struct serialization and added Enum formatter#6

Merged
prikolium-cfx merged 3 commits intocitizenfx:masterfrom
manups4e:master
Jun 23, 2025
Merged

fix(vendor/msgpack-cs): fix formatter struct serialization and added Enum formatter#6
prikolium-cfx merged 3 commits intocitizenfx:masterfrom
manups4e:master

Conversation

@manups4e
Copy link
Contributor

@manups4e manups4e commented Jun 10, 2025

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:
    image

  • After:
    image


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.

image

image

Copy link

@FabianTerhorst FabianTerhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

…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.
@manups4e manups4e changed the title fix(vendor/msgpack-cs): fix foormatter struct serialization fix(vendor/msgpack-cs): fix formatter struct serialization and added Enum formatter Jun 18, 2025
@manups4e manups4e requested a review from FabianTerhorst June 18, 2025 15:00
Copy link

@FabianTerhorst FabianTerhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me.

@prikolium-cfx prikolium-cfx merged commit f93ac25 into citizenfx:master Jun 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants