// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #nullable enable using System; using System.Diagnostics.CodeAnalysis; namespace MessagePack { /// /// An exception thrown during serializing an object graph or deserializing a messagepack sequence. /// [Serializable] #if MESSAGEPACK_INTERNAL internal #else public #endif class MessagePackSerializationException : Exception { /// /// Initializes a new instance of the class. /// public MessagePackSerializationException() { } /// /// Initializes a new instance of the class. /// /// The exception message. public MessagePackSerializationException(string? message) : base(message) { } /// /// Initializes a new instance of the class. /// /// The exception message. /// The inner exception. public MessagePackSerializationException(string? message, Exception? inner) : base(message, inner) { } /// /// Initializes a new instance of the class. /// /// Serialization info. /// Serialization context. protected MessagePackSerializationException( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } [DoesNotReturn] internal static Exception ThrowUnexpectedNilWhileDeserializing() => throw new MessagePackSerializationException("Unexpected nil encountered while deserializing " + typeof(T).FullName); } }