Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Discovery;

/// <summary>
/// Helps us communicate results that were created inside of AppDomain, when AppDomains are available and enabled.
/// </summary>
/// <param name="TestElements">The test elements that were discovered.</param>
/// <param name="Warnings">Warnings that happened during discovery.</param>
[Serializable]
internal sealed record AssemblyEnumerationResult(List<UnitTestElement> TestElements, List<string> Warnings);
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@
/// Enumerates through all types in the assembly in search of valid test methods.
/// </summary>
/// <param name="assemblyFileName">The assembly file name.</param>
/// <param name="warnings">Contains warnings if any, that need to be passed back to the caller.</param>

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error CS1572: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has a param tag for 'warnings', but there is no parameter by that name

Check failure on line 65 in src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs#L65

src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs(65,22): error SA1612: (NETCORE_ENGINEERING_TELEMETRY=Build) The parameter 'warnings' does not exist (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1612.md)
/// <returns>A collection of Test Elements.</returns>
internal ICollection<UnitTestElement> EnumerateAssembly(
string assemblyFileName,
List<string> warnings)
internal AssemblyEnumerationResult EnumerateAssembly(string assemblyFileName)
{
List<string> warnings = new();
DebugEx.Assert(!StringEx.IsNullOrWhiteSpace(assemblyFileName), "Invalid assembly file name.");
var tests = new List<UnitTestElement>();
// Contains list of assembly/class names for which we have already added fixture tests.
Expand Down Expand Up @@ -117,7 +116,7 @@
tests.AddRange(testsInType);
}

return tests;
return new AssemblyEnumerationResult(tests, warnings);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ private static ICollection<UnitTestElement> GetTestsInIsolation(string fullFileP
PlatformServiceProvider.Instance.AdapterTraceLogger.LogWarning(Resource.OlderTFMVersionFound);
}

return assemblyEnumerator.EnumerateAssembly(fullFilePath, warnings);
// This method runs inside of appdomain, when appdomains are available and enabled.
// Don't move the 'warning' parameter to be written into by reference, it will not return the warnings from appdomain.
AssemblyEnumerationResult result = assemblyEnumerator.EnumerateAssembly(fullFilePath);
warnings.AddRange(result.Warnings);
return result.TestElements;
}
}
Loading