Skip to content

Commit

Permalink
Obsolete InternalTestFailureException and GenericParameterHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jan 17, 2025
1 parent d07b313 commit 1bb887a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/TestFramework/TestFramework/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

/// <summary>
/// Constants used throughout.
/// </summary>
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.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
/// This class is only added to preserve source compatibility with the V1 framework.
/// For all practical purposes either use AssertFailedException/AssertInconclusiveException.
/// </remarks>
#if RELEASE
#if NET6_0_OR_GREATER
[Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")]
#else
[Obsolete(Constants.PublicTypeObsoleteMessage)]
#endif
#endif
[Serializable]
public class InternalTestFailureException : UnitTestAssertException
{
Expand Down
8 changes: 7 additions & 1 deletion src/TestFramework/TestFramework/GenericParameterHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
// This next suppression could mask a problem, since Equals and CompareTo may not agree!
[SuppressMessage("Microsoft.Design", "CA1036:OverrideMethodsOnComparableTypes", Justification = "Compat reasons.")]
[SuppressMessage("Design", "CA1010:Generic interface should also be implemented", Justification = "Part of the public API")]

#if RELEASE
#if NET6_0_OR_GREATER
[Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")]
#else
[Obsolete(Constants.PublicTypeObsoleteMessage)]
#endif
#endif
// GenericParameterHelper in full CLR version also implements ICloneable, but we don't have ICloneable in core CLR
public class GenericParameterHelper : IComparable, IEnumerable
{
Expand Down

0 comments on commit 1bb887a

Please sign in to comment.