Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ReferenceTrimmer #5009

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@

<!-- Versioning -->
<PropertyGroup>
<MSTestEnginePreReleaseVersionLabel>alpha</MSTestEnginePreReleaseVersionLabel>

<!--
This is a early preview package, keep 1.0.0-alpha or similar suffix even in official builds.
-->
<MSTestEngineVersionPrefix>1.0.0</MSTestEngineVersionPrefix>
<MSTestEnginePreReleaseVersionLabel>alpha</MSTestEnginePreReleaseVersionLabel>
</PropertyGroup>

<!-- Pack config -->
Expand All @@ -63,6 +62,12 @@
<PolyGuard>true</PolyGuard>
</PropertyGroup>

<!-- Test config -->
<PropertyGroup>
<!-- Set the test runner here and not in test folder so that arcade doesn't force add xunit to any folder of the repo -->
<TestRunnerName>TestingPlatformRunner</TestRunnerName>
</PropertyGroup>

<ItemGroup>
<Using Include="System.Collections" />
<Using Include="System.Collections.Concurrent" />
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(MicrosoftCodeAnalysisPublicApiAnalyzersVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.13.2" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<GlobalPackageReference Include="ReferenceTrimmer" Version="3.3.10" />
</ItemGroup>
<ItemGroup Label="Product dependencies">
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
Expand Down
1 change: 1 addition & 0 deletions TestFx.sln
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IntegrationTests", "Integra
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestAssets", "TestAssets", "{C9F82701-0E0F-4E61-B05B-AE387E7631F6}"
ProjectSection(SolutionItems) = preProject
test\IntegrationTests\TestAssets\Directory.Build.props = test\IntegrationTests\TestAssets\Directory.Build.props
test\IntegrationTests\TestAssets\Directory.Build.targets = test\IntegrationTests\TestAssets\Directory.Build.targets
EndProjectSection
EndProject
Expand Down
1 change: 0 additions & 1 deletion samples/Playground/Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers.CodeFixes\MSTest.Analyzers.CodeFixes.csproj" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers\MSTest.Analyzers.csproj" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<PackageReference Include="StreamJsonRpc" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTestAdapter.PlatformServices\MSTestAdapter.PlatformServices.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.VSTestBridge\Microsoft.Testing.Extensions.VSTestBridge.csproj" Condition=" '$(TargetFramework)' != '$(UwpMinimum)' " />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.VSTestBridge\Microsoft.Testing.Extensions.VSTestBridge.csproj"
Condition=" '$(TargetFramework)' != '$(UwpMinimum)' AND '$(TargetFramework)' != '$(ModernUwpMinimum)' " />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Internal.Analyzers\MSTest.Internal.Analyzers.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Expand All @@ -63,7 +64,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.AdapterUtilities" />
<PackageReference Include="System.Threading.Tasks.Extensions" Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(NetFrameworkMinimum)' OR '$(TargetFramework)' == '$(UwpMinimum)' " />
<PackageReference Include="System.Threading.Tasks.Extensions"
Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(NetFrameworkMinimum)' OR '$(TargetFramework)' == '$(UwpMinimum)' " />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MSTest.Analyzers.CodeFixes\MSTest.Analyzers.CodeFixes.csproj" />
<ProjectReference Include="..\MSTest.Analyzers\MSTest.Analyzers.csproj" />
<ProjectReference Include="..\MSTest.Analyzers.CodeFixes\MSTest.Analyzers.CodeFixes.csproj" NoWarn="RT0002" />
<ProjectReference Include="..\MSTest.Analyzers\MSTest.Analyzers.csproj" NoWarn="RT0002" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 10 additions & 5 deletions src/Package/MSTest/MSTest.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>

<!-- SDK top import -->
<Import Project="Sdk.props" Sdk="MSBuild.Sdk.Extras" Condition=" '$(OS)' == 'Windows_NT' " />
Expand Down Expand Up @@ -44,10 +44,15 @@
</Target>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTest.TestAdapter\MSTest.TestAdapter.csproj" />
<ProjectReference Include="$(RepoRoot)src\TestFramework\TestFramework.Extensions\TestFramework.Extensions.csproj" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers.Package\MSTest.Analyzers.Package.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj" Condition=" '$(TargetFramework)' != '$(UwpMinimum)' " />
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTest.TestAdapter\MSTest.TestAdapter.csproj"
NoWarn="RT0002" />
<ProjectReference Include="$(RepoRoot)src\TestFramework\TestFramework.Extensions\TestFramework.Extensions.csproj"
NoWarn="RT0002" />
<ProjectReference Include="$(RepoRoot)src\Analyzers\MSTest.Analyzers.Package\MSTest.Analyzers.Package.csproj"
NoWarn="RT0002" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj"
Condition=" '$(TargetFramework)' != '$(UwpMinimum)' "
NoWarn="RT0002" />

<!-- CodeCoverage 17.14 doesn't support netcoreapp3.1. -->
<!-- We end up having System.Collections.Immutable 8.0.0 which is not compatible with netcoreapp3.1 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ This package extends Microsoft Testing Platform to provide a crash dump function

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport.Abstractions\Microsoft.Testing.Extensions.TrxReport.Abstractions.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Does this affect the publicly visible dependencies of CrashDump?

</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport.Abstractions\Microsoft.Testing.Extensions.TrxReport.Abstractions.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" ReferenceOutputAssembly="false" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect the publicly visible dependencies of the VSTestBridge NuGet package?

</ItemGroup>

<!-- NuGet properties -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" PrivateAssets="All" />
<PackageReference Include="Microsoft.Win32.Registry" PrivateAssets="All" />
<PackageReference Include="Microsoft.Win32.Registry" PrivateAssets="All" NoWarn="RT0003" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj" CopyToBuildOutput="true" />
<!-- Deps only so we can include it in the lib of the NuGet package -->
<ProjectReference Include="$(RepoRoot)\src\Platform\Microsoft.Testing.Extensions.MSBuild\Microsoft.Testing.Extensions.MSBuild.csproj" PrivateAssets="All" />
<ProjectReference Include="$(RepoRoot)\src\Platform\Microsoft.Testing.Extensions.MSBuild\Microsoft.Testing.Extensions.MSBuild.csproj" PrivateAssets="All"
NoWarn="RT0002" />
</ItemGroup>

<!-- NuGet properties -->
Expand Down
3 changes: 1 addition & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<Import Project="../Directory.Build.props" />

<PropertyGroup>
<TestRunnerName>TestingPlatformRunner</TestRunnerName>
<PropertyGroup>
<!-- By default we run tests with VSTest runner and custom test framework. Platform projects will use a different runner and framework -->
<UseVSTestRunner Condition=" '$(UseVSTestRunner)' == '' " >true</UseVSTestRunner>
<Nullable>enable</Nullable>
Expand Down
1 change: 1 addition & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.CrashDump\Microsoft.Testing.Extensions.CrashDump.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.HangDump\Microsoft.Testing.Extensions.HangDump.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Retry\Microsoft.Testing.Extensions.Retry.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" GeneratePathProperty="True" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();

// Custom suite tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddTrxReportProvider();
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();

// Custom suite tools
CompositeExtensionFactory<SlowestTestsConsumer> slowestTestCompositeServiceFactory
Expand Down
9 changes: 9 additions & 0 deletions test/IntegrationTests/TestAssets/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../../'))" />

<PropertyGroup>
<EnableReferenceTrimmer>false</EnableReferenceTrimmer>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions test/IntegrationTests/TestAssets/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
<ItemGroup>
<ProjectCapability Remove="TestContainer" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeRefactoring.Testing" />

<!-- Deps of MSTest.TestAdapter -->
<PackageReference Include="Microsoft.TestPlatform.AdapterUtilities" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion test/UnitTests/MSTest.Analyzers.UnitTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddCrashDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();

// Custom suite tools
Expand Down
5 changes: 3 additions & 2 deletions test/UnitTests/MSTest.Engine.UnitTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();
builder.AddAppInsightsTelemetryProvider();

// Custom suite tools
CompositeExtensionFactory<SlowestTestsConsumer> slowestTestCompositeServiceFactory
Expand Down
5 changes: 3 additions & 2 deletions test/UnitTests/MSTest.SourceGeneration.UnitTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();
builder.AddAppInsightsTelemetryProvider();

// Custom suite tools
CompositeExtensionFactory<SlowestTestsConsumer> slowestTestCompositeServiceFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();
builder.AddAppInsightsTelemetryProvider();

// Custom suite tools
CompositeExtensionFactory<SlowestTestsConsumer> slowestTestCompositeServiceFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
Console.WriteLine("NATIVE_AOT disabled");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional?

builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
Console.WriteLine("NATIVE_AOT disabled");
#else
Console.WriteLine("NATIVE_AOT enabled");
#endif

builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddRetryProvider();
builder.AddTrxReportProvider();

// Custom suite tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddHangDumpProvider();
builder.AddAppInsightsTelemetryProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddHangDumpProvider();
builder.AddRetryProvider();
builder.AddTrxReportProvider();

// Custom suite tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddCrashDumpProvider();
builder.AddAppInsightsTelemetryProvider();
Copy link
Member

@Youssef1313 Youssef1313 Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Evangelink Any reason telemetry wasn't enabled previously? Is it intentional for our tests to opt-out for telemetry? It's already enabled for two other test projects

builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why ignoreIfNotSupported was not needed previously

builder.AddHangDumpProvider();
builder.AddRetryProvider();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Evangelink Do we want to use re-try for unit tests? I'm afraid this could hide race conditions and flaky tests that indicate real issues

builder.AddTrxReportProvider();

// Custom suite tools
Expand Down
Loading