diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs index 974a1ba58c85a2..759f508fad0df0 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs @@ -37,7 +37,7 @@ public void TestException(string? message, bool innerException) Assert.Equal(message, thrownException.Message); } - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] [InlineData("Test Message")] [InlineData(null)] public void TestSerialization(string? message) @@ -55,8 +55,9 @@ public void TestSerialization(string? message) Assert.Null(deserializedException.InnerException); } - [Fact] - public void TestSerializationDefaultConstructor() { + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] + public void TestSerializationDefaultConstructor() + { var exception = new HostAbortedException(); using var serializationStream = new MemoryStream();