Skip to content

Commit 0df4e16

Browse files
committed
Fix warning in .NET 8 code around serialization
Fixes the following warning in .NET 8 builds (currently only via the integration test project): > tests\Common\ThrowingTraceListener.cs(50,101,50,122): warning SYSLIB0051: 'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
1 parent b92f25a commit 0df4e16

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/Common/ThrowingTraceListener.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ public override void WriteLine(string message)
3232
{
3333
}
3434

35+
#if !NET8_0_OR_GREATER
3536
[Serializable]
37+
#endif
3638
public class DebugAssertFailureException : Exception
3739
{
3840
public DebugAssertFailureException()
@@ -47,9 +49,11 @@ public DebugAssertFailureException(string message, Exception inner) : base(messa
4749
{
4850
}
4951

52+
#if !NET8_0_OR_GREATER
5053
protected DebugAssertFailureException(SerializationInfo info, StreamingContext context) : base(info, context)
5154
{
5255
}
56+
#endif
5357
}
5458
}
5559
}

0 commit comments

Comments
 (0)