diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs index 78b6d36363..c0bdef2cbb 100644 --- a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs @@ -11,5 +11,8 @@ public class InvalidManagedNameException : Exception, ISerializable { public InvalidManagedNameException(string? message) : base(message) { } +#if NET8_0_OR_GREATER + [Obsolete("Serialization constructors are deprecated in .NET8+", DiagnosticId = "SYSLIB0051")] +#endif protected InvalidManagedNameException(SerializationInfo info, StreamingContext context) : base(info, context) { } }