Table of Contents

MessagePack analyzers

The Nerdbank.MessagePack nuget packages comes with C# analyzers to help you author valid code. They will emit diagnostics with warnings or errors depending on the severity of the issue.

Some of these diagnostics will include a suggested code fix that can apply the correction to your code automatically.

Rule ID Category Severity Notes
NBMsgPack001 Usage Error Apply [Key] consistently across members
NBMsgPack002 Usage Warning Avoid [Key] on non-serialized members
NBMsgPack003 Usage Error [Key] index must be unique
NBMsgPack010 Usage Error [KnownSubType] should specify an assignable type
NBMsgPack011 Usage Error [KnownSubType] alias must be unique
NBMsgPack012 Usage Error [KnownSubType] type must be unique
NBMsgPack020 Usage Error [MessagePackConverter] type must be compatible converter
NBMsgPack021 Usage Error [MessagePackConverter] type missing default constructor
NBMsgPack030 Usage Warning Converters should not call top-level MessagePackSerializer methods
NBMsgPack031 Usage Warning Converters should read or write exactly one msgpack structure
NBMsgPack032 Usage Info Converters should override GetJsonSchema
NBMsgPack033 Usage Error Async converters should return writers
NBMsgPack034 Usage Error Async converters should not reuse MessagePackWriter after returning it
NBMsgPack035 Usage Error Async converters should return readers
NBMsgPack036 Usage Error Async converters should not reuse readers after returning them
NBMsgPack037 Usage Warning Async converters should override PreferAsyncSerialization
NBMsgPack050 Usage Warning Use ref parameters for ref structs
NBMsgPack051 Usage Warning Prefer modern .NET APIs
NBMsgPack060 Usage Error UnusedDataPacket member should have a property shape
NBMsgPack061 Usage Error UnusedDataPacket member should not have a KeyAttribute
NBMsgPack062 Usage Warning UnusedDataPacket properties should be private
NBMsgPack070 Usage Error UseComparerAttribute type must not be an open generic
NBMsgPack071 Usage Error UseComparerAttribute member name must point to a valid property
NBMsgPack072 Usage Error UseComparerAttribute must specify a compatible comparer
NBMsgPack073 Usage Error UseComparerAttribute type must not be abstract unless using static member
NBMsgPack100 Migration Info Migrate MessagePack-CSharp formatter
NBMsgPack101 Migration Info Migrate to MessagePackConverterAttribute
NBMsgPack102 Migration Info Remove use of MessagePackObjectAttribute
NBMsgPack103 Migration Info Use newer KeyAttribute
NBMsgPack104 Migration Info Remove use of IgnoreMemberAttribute
NBMsgPack105 Migration Info Implement IMessagePackSerializationCallbacks
NBMsgPack106 Migration Info Use ConstructorShapeAttribute