diff --git a/eng/Versions.props b/eng/Versions.props index faa07edd0a..7730f76fe6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,7 +13,7 @@ from appending +, which breaks DTAAgent. --> false - 17.14.0 + 17.14.1 release diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index 8b922cde5f..f1595e100f 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -18,7 +18,7 @@ function Verify-Nuget-Packages { Write-Host "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 59; - "Microsoft.NET.Test.Sdk" = 15; + "Microsoft.NET.Test.Sdk" = 25; "Microsoft.TestPlatform" = 619; "Microsoft.TestPlatform.Build" = 20; "Microsoft.TestPlatform.CLI" = 481; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/FeatureFlag/FeatureFlag.cs b/src/Microsoft.TestPlatform.CoreUtilities/FeatureFlag/FeatureFlag.cs index 9a5506a87b..76f8ec1546 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/FeatureFlag/FeatureFlag.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/FeatureFlag/FeatureFlag.cs @@ -72,8 +72,6 @@ private FeatureFlag() { } // Disable not sharing .NET Framework testhosts. Which will return behavior to sharing testhosts when they are running .NET Framework dlls, and are not disabling appdomains or running in parallel. public const string VSTEST_DISABLE_SHARING_NETFRAMEWORK_TESTHOST = nameof(VSTEST_DISABLE_SHARING_NETFRAMEWORK_TESTHOST); - // Disable outputting Traits into TRX file in the Properties node. - public const string VSTEST_DISABLE_TRX_WRITE_PROPERTIES = nameof(VSTEST_DISABLE_TRX_WRITE_PROPERTIES); [Obsolete("Only use this in tests.")] internal static void Reset() diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs index 69fa32de84..7c61240ca3 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestHostRuntimeProvider, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.arm64, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CoreUtilities.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft.TestPlatform.Extensions.TrxLogger.csproj b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft.TestPlatform.Extensions.TrxLogger.csproj index 3f81980538..d224d7bda0 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft.TestPlatform.Extensions.TrxLogger.csproj +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft.TestPlatform.Extensions.TrxLogger.csproj @@ -30,6 +30,7 @@ + @@ -43,6 +44,11 @@ + + True + True + NullableHelpers.tt + True True @@ -70,6 +76,13 @@ + + + TextTemplatingFileGenerator + NullableHelpers.cs + + + diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/Property.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/Property.cs deleted file mode 100644 index 6061d8f78c..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/Property.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; - -using Microsoft.TestPlatform.Extensions.TrxLogger.XML; -using Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger; - -namespace Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; - -/// -/// Stores a string which categorizes the Test -/// -internal sealed class Property : IXmlTestStore -{ - [StoreXmlSimpleField(Location = "@Key", DefaultValue = "")] - private readonly string _key = string.Empty; - [StoreXmlSimpleField(Location = "@Value", DefaultValue = "")] - private readonly string _value = string.Empty; - - /// - /// Create a new item with the property set - /// - public Property(string key, string value) - { - // Treat null as empty. - - _key = StripIllegalChars(key); - _value = StripIllegalChars(value); - } - - /// - /// Gets the property for this Trait - /// - public string Trait - { - get - { - return _key; - } - } - - private static string StripIllegalChars(string property) - { - string ret = property.Trim(); - ret = ret.Replace("&", string.Empty); - ret = ret.Replace("|", string.Empty); - ret = ret.Replace("!", string.Empty); - ret = ret.Replace(",", string.Empty); - return ret; - } - - /// - /// Compare the values of the items - /// - /// Value being compared to. - /// True if the values are the same and false otherwise. - public override bool Equals(object? other) - { - if (other is not Property otherItem) - { - return false; - } - - TPDebug.Assert(_key != null, "property is null"); - return string.Equals(_key, otherItem._key, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Convert the property name to a hashcode - /// - /// Hashcode of the property. - public override int GetHashCode() - { - TPDebug.Assert(_key != null, "property is null"); - return _key.ToUpperInvariant().GetHashCode(); - } - - /// - /// Convert the property name to a string - /// - /// The property. - public override string ToString() - { - TPDebug.Assert(_key != null, "property is null"); - return _key; - } - - /// - /// Saves the class under the XmlElement. - /// - /// XmlElement element - /// XmlTestStoreParameters parameters - public void Save(System.Xml.XmlElement element, XmlTestStoreParameters? parameters) - { - new XmlPersistence().SaveSingleFields(element, this, parameters); - } -} diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/PropertyCollection.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/PropertyCollection.cs deleted file mode 100644 index 037b086d00..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/PropertyCollection.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Text; - -using Microsoft.TestPlatform.Extensions.TrxLogger.Utility; -using Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger; - -namespace Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; - -/// -/// A collection of strings which categorize the test. -/// -internal sealed class PropertyCollection : EqtBaseCollection -{ - /// - /// Creates an empty PropertyCollection. - /// - public PropertyCollection() - { - } - - /// - /// Adds the property. - /// - /// Key to be added. - /// Value to be added. - public void Add(string key, string value) - { - Add(new Property(key, value)); - } - - /// - /// Adds the property. - /// - /// Property to be added. - public override void Add(Property item) - { - EqtAssert.ParameterNotNull(item, nameof(item)); - - // Don't add empty items. - if (!item.Trait.IsNullOrEmpty()) - { - base.Add(item); - } - } - - /// - /// Convert the PropertyCollection to a string. - /// each item is surrounded by a comma (,) - /// - /// - public override string ToString() - { - StringBuilder returnString = new(); - if (Count > 0) - { - returnString.Append(','); - foreach (Property item in this) - { - returnString.Append(item.Trait); - returnString.Append(','); - } - } - - return returnString.ToString(); - } - - /// - /// Convert the PropertyCollection to an array of strings. - /// - /// Array of strings containing the test categories. - public string[] ToArray() - { - string[] result = new string[Count]; - - int i = 0; - foreach (Property item in this) - { - result[i++] = item.Trait; - } - - return result; - } - - /// - /// Compare the collection items - /// - /// other collection - /// true if the collections contain the same items - public override bool Equals(object? obj) - { - bool result = false; - - if (obj is not PropertyCollection other) - { - // Other object is not a TraitItemCollection. - result = false; - } - else if (ReferenceEquals(this, other)) - { - // The other object is the same object as this one. - result = true; - } - else if (Count != other.Count) - { - // The count of categories in the other object does not - // match this one, so they are not equal. - result = false; - } - else - { - // Check each item and return on the first mismatch. - foreach (Property item in this) - { - if (!other.Contains(item)) - { - result = false; - break; - } - } - } - - return result; - } - - /// - /// Return the hash code of this collection - /// - /// The hashcode. - public override int GetHashCode() - { - return base.GetHashCode(); - } -} diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestElement.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestElement.cs index 6bd68d9d79..32c9c69cf2 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestElement.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestElement.cs @@ -32,7 +32,6 @@ internal abstract class TestElement : ITestElement, IXmlTestStore protected TestExecId _executionId; protected TestExecId _parentExecutionId; protected TestCategoryItemCollection _testCategories; - protected PropertyCollection _properties; protected WorkItemCollection _workItems; protected TestListCategoryId _catId; @@ -47,7 +46,6 @@ public TestElement(Guid id, string name, string adapter) _executionId = TestExecId.Empty; _parentExecutionId = TestExecId.Empty; _testCategories = new TestCategoryItemCollection(); - _properties = new PropertyCollection(); _workItems = new WorkItemCollection(); _isRunnable = true; _catId = TestListCategoryId.Uncategorized; @@ -187,21 +185,6 @@ public WorkItemCollection WorkItems } } - - /// - /// Gets or sets the test traits. - /// - public PropertyCollection Traits - { - get { return _properties; } - - set - { - EqtAssert.ParameterNotNull(value, "value"); - _properties = value; - } - } - /// /// Gets the adapter name. /// @@ -262,7 +245,6 @@ public virtual void Save(System.Xml.XmlElement element, XmlTestStoreParameters? h.SaveSimpleField(element, "@priority", _priority, DefaultPriority); h.SaveSimpleField(element, "Owners/Owner/@name", _owner, string.Empty); h.SaveObject(_testCategories, element, "TestCategory", parameters); - h.SaveObject(_properties, element, "Properties", parameters); if (_executionId != null) h.SaveGuid(element, "Execution/@id", _executionId.Id); diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index 37ea65ac8e..5967dbb202 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -14,7 +14,6 @@ using Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; -using Microsoft.VisualStudio.TestPlatform.Utilities; using TrxLoggerResources = Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.Resources.TrxResource; using TrxObjectModel = Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; @@ -77,14 +76,6 @@ public static ITestElement ToTestElement( testElement.WorkItems.Add(workItem); } - if (!FeatureFlag.Instance.IsSet(nameof(FeatureFlag.VSTEST_DISABLE_TRX_WRITE_PROPERTIES))) - { - foreach (var trait in rockSteadyTestCase.Traits.Where(t => t.Name is not "Owner" and not "Priority")) - { - testElement.Traits.Add(new Property(trait.Name, trait.Value)); - } - } - return testElement; } diff --git a/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.csproj b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.csproj index 1764ba0ef3..6c3cb6a586 100644 --- a/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.csproj +++ b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.csproj @@ -29,6 +29,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec index 54e0694f48..13812afbd9 100644 --- a/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec +++ b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec @@ -8,10 +8,15 @@ + + + + + @@ -21,11 +26,27 @@ - + + + + + + + + + + + + + + + + + diff --git a/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.targets b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.targets new file mode 100644 index 0000000000..d2d47da66e --- /dev/null +++ b/src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.targets @@ -0,0 +1,6 @@ + + + + +