Upgrade MessagePack from 2.5.192 to 3.x
Summary
The MessagePack package is currently pinned at version 2.5.192 in eng/Packages.Data.props. Version 3.x is now available with significant improvements but includes breaking changes that require a dedicated migration effort.
Current State
- Current Version: 2.5.192
- Latest Version: 3.1.4
- Location:
eng/Packages.Data.props line ~280
Why Upgrade?
MessagePack 3.x introduces:
- AOT source generation by default using Roslyn source generators (improved startup performance, better debugging)
- Support for serializing private members without
DynamicObjectResolverAllowPrivate
- Analyzers enabled by default with new diagnostics
- Custom formatters automatically discovered in same assembly
- New
[CompositeResolver] attribute for faster runtime alternative
- .NET 9 support with
Int128, UInt128, Rune, OrderedDictionary<T,V>, ReadOnlySet<T>
Breaking Changes
Major Changes
mpc tool is no longer available - replaced by Roslyn source generators
- AOT source generation is the default - dynamic formatters still exist but are secondary
- Custom formatters auto-discovery - formatters in same assembly are automatically used unless attributed with
[ExcludeFormatterFromSourceGeneratedResolver]
- Unity distribution changed - now via NuGetForUnity and UPM instead of
.unitypackage
Migration Required
- Review all
[MessagePackObject] types for compatibility
- Update any code that relied on
mpc generation
- Test serialization behavior with new source generator
- Review analyzer warnings (now on by default)
Migration Guide
Upgrade MessagePack from 2.5.192 to 3.x
Summary
The
MessagePackpackage is currently pinned at version 2.5.192 ineng/Packages.Data.props. Version 3.x is now available with significant improvements but includes breaking changes that require a dedicated migration effort.Current State
eng/Packages.Data.propsline ~280Why Upgrade?
MessagePack 3.x introduces:
DynamicObjectResolverAllowPrivate[CompositeResolver]attribute for faster runtime alternativeInt128,UInt128,Rune,OrderedDictionary<T,V>,ReadOnlySet<T>Breaking Changes
Major Changes
mpctool is no longer available - replaced by Roslyn source generators[ExcludeFormatterFromSourceGeneratedResolver].unitypackageMigration Required
[MessagePackObject]types for compatibilitympcgenerationMigration Guide
Official migration guide
Detailed blog