Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored and github-actions committed Feb 18, 2025
1 parent ca157f0 commit 46c08e7
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 44 deletions.
3 changes: 3 additions & 0 deletions src/Adapter/MSTest.Engine/Assertions/AssertFailedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public AssertFailedException(string message, Exception ex)
{
}

#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")]
#endif
private AssertFailedException(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
}
Expand Down
2 changes: 0 additions & 2 deletions src/TestFramework/TestFramework/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
internal static class Constants
{
internal const string PublicTypeObsoleteMessage = "We will remove or hide this type starting with v4. If you are using this type, reach out to our team on https://github.com/microsoft/testfx.";

internal const string LegacyFormatterImplementationMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK || NETSTANDARD2_0
using System.ComponentModel;
using System.Runtime.Serialization;
#endif

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -41,17 +39,17 @@ public AssertFailedException()
{
}

#if NETFRAMEWORK || NETSTANDARD2_0
/// <summary>
/// Initializes a new instance of the <see cref="AssertFailedException"/> class.
/// </summary>
/// <param name="info">Serialization info.</param>
/// <param name="context">Streaming context.</param>
[Obsolete(Constants.LegacyFormatterImplementationMessage)]
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
protected AssertFailedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK || NETSTANDARD2_0
using System.ComponentModel;
using System.Runtime.Serialization;
#endif

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -41,17 +39,17 @@ public AssertInconclusiveException()
{
}

#if NETFRAMEWORK || NETSTANDARD2_0
/// <summary>
/// Initializes a new instance of the <see cref="AssertInconclusiveException"/> class.
/// </summary>
/// <param name="info">Serialization info.</param>
/// <param name="context">Streaming context.</param>
[Obsolete(Constants.LegacyFormatterImplementationMessage)]
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
protected AssertInconclusiveException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK || NETSTANDARD2_0
using System.ComponentModel;
using System.Runtime.Serialization;
#endif

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -52,17 +50,17 @@ public InternalTestFailureException()
{
}

#if NETFRAMEWORK || NETSTANDARD2_0
/// <summary>
/// Initializes a new instance of the <see cref="InternalTestFailureException"/> class.
/// </summary>
/// <param name="info">Serialization info.</param>
/// <param name="context">Streaming context.</param>
[Obsolete(Constants.LegacyFormatterImplementationMessage)]
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
protected InternalTestFailureException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK || NETSTANDARD2_0
using System.ComponentModel;
using System.Runtime.Serialization;
#endif

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -40,17 +38,17 @@ protected UnitTestAssertException(string msg)
{
}

#if NETFRAMEWORK || NETSTANDARD2_0
/// <summary>
/// Initializes a new instance of the <see cref="UnitTestAssertException"/> class.
/// </summary>
/// <param name="info">Serialization info.</param>
/// <param name="context">Streaming context.</param>
[Obsolete(Constants.LegacyFormatterImplementationMessage)]
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
protected UnitTestAssertException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
<<<<<<< HEAD

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L2

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '<<<<<<< HEAD' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
abstract Microsoft.VisualStudio.TestTools.UnitTesting.ConditionBaseAttribute.IgnoreMessage.get -> string?
abstract Microsoft.VisualStudio.TestTools.UnitTesting.ConditionBaseAttribute.GroupName.get -> string!
abstract Microsoft.VisualStudio.TestTools.UnitTesting.ConditionBaseAttribute.ShouldRun.get -> bool
Expand Down Expand Up @@ -375,3 +376,9 @@ static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.ThrowsExactlyAsync<TE
[MSTESTEXP]Microsoft.VisualStudio.TestTools.UnitTesting.RetryResult
[MSTESTEXP]Microsoft.VisualStudio.TestTools.UnitTesting.RetryResult.AddResult(Microsoft.VisualStudio.TestTools.UnitTesting.TestResult![]! testResults) -> void
[MSTESTEXP]Microsoft.VisualStudio.TestTools.UnitTesting.RetryResult.RetryResult() -> void
=======

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 379 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L379

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(379,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '=======' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException.AssertFailedException(System.Runtime.Serialization.SerializationInfo! info, System.Runtime.Serialization.StreamingContext context) -> void
Microsoft.VisualStudio.TestTools.UnitTesting.AssertInconclusiveException.AssertInconclusiveException(System.Runtime.Serialization.SerializationInfo! info, System.Runtime.Serialization.StreamingContext context) -> void
Microsoft.VisualStudio.TestTools.UnitTesting.InternalTestFailureException.InternalTestFailureException(System.Runtime.Serialization.SerializationInfo! info, System.Runtime.Serialization.StreamingContext context) -> void
Microsoft.VisualStudio.TestTools.UnitTesting.UnitTestAssertException.UnitTestAssertException(System.Runtime.Serialization.SerializationInfo! info, System.Runtime.Serialization.StreamingContext context) -> void
>>>>>>> Address review feedback

Check failure on line 384 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L384

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(384,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '>>>>>>> Address review feedback' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 384 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L384

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(384,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '>>>>>>> Address review feedback' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 384 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L384

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(384,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '>>>>>>> Address review feedback' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 384 in src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt#L384

src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt(384,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol '>>>>>>> Address review feedback' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions src/TestFramework/TestFramework/TestFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@

<AdditionalFiles Include="PublicAPI\net\PublicAPI.Shipped.txt" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))" />
<AdditionalFiles Include="PublicAPI\net\PublicAPI.Unshipped.txt" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))" />

<AdditionalFiles Include="PublicAPI\netframework\PublicAPI.Shipped.txt" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net462'))" />
<AdditionalFiles Include="PublicAPI\netframework\PublicAPI.Unshipped.txt" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net462'))" />

<AdditionalFiles Include="PublicAPI\netstandard2.0\PublicAPI.Shipped.txt" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<AdditionalFiles Include="PublicAPI\netstandard2.0\PublicAPI.Unshipped.txt" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK
using System.Runtime.Serialization.Formatters.Binary;

using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -10,15 +9,15 @@

namespace Microsoft.VisualStudio.TestPlatform.TestFramework.UnitTests.Attributes;

public class BinaryFormatterExceptionSerializationTests : TestContainer
[Obsolete]
public sealed class BinaryFormatterExceptionSerializationTests : TestContainer
{
public void AssertFailedExceptionCanBeSerializedAndDeserialized()
=> VerifySerialization(Assert.Fail);

public void AssertInconclusiveExceptionCanBeSerializedAndDeserialized()
=> VerifySerialization(Assert.Inconclusive);

[Obsolete]
public void InternalTestFailureExceptionCanBeSerializedAndDeserialized()
=> VerifySerialization(() => throw new InternalTestFailureException("Some internal error."));

Expand All @@ -43,4 +42,3 @@ private void VerifySerialization(Action actionThatThrows)
throw new InvalidOperationException($"The provided '{nameof(actionThatThrows)}' did not throw any exception.");
}
}
#endif

0 comments on commit 46c08e7

Please sign in to comment.