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

Ensure we run adapter tests for all supported TFMs #1267

Merged
merged 1 commit into from
Sep 22, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ internal static string GetLoadExceptionDetails(ReflectionTypeLoadException ex)
var map = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); // Exception -> null.
var errorDetails = new StringBuilder();

if (ex.LoaderExceptions != null)
if (ex.LoaderExceptions?.Length > 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like a change of behavior on .NET where we now have empty array instead of null.

{
// Loader exceptions can contain duplicates, leave only unique exceptions.
foreach (var loaderException in ex.LoaderExceptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462</TargetFrameworks>
<NetStandardNetFrameworkHolder>net48</NetStandardNetFrameworkHolder>
<TargetFrameworks>net462;$(NetStandardNetFrameworkHolder);netcoreapp3.1;net6.0;$(WinUiMinimum)</TargetFrameworks>
<IsNetCoreApp Condition=" '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == '$(WinUiMinimum)' ">true</IsNetCoreApp>
<RootNamespace>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests</RootNamespace>
<AssemblyName>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests</AssemblyName>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>

<!-- Properties specific to WinUI -->
<PropertyGroup Condition=" '$(TargetFramework)' == '$(WinUiMinimum)' ">
<DefineConstants>$(DefineConstants);WIN_UI</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
Expand All @@ -15,14 +21,14 @@
<DebugType>pdbonly</DebugType>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetStandardNetFrameworkHolder)' ">
<ProjectReference Include="$(RepoRoot)src\TestFramework\Extension\Extension.csproj" SetTargetFramework="TargetFramework=netstandard2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Adapter\MSTest.TestAdapter\MSTest.TestAdapter.csproj" />
<ProjectReference Include="$(RepoRoot)src\TestFramework\MSTest.Core\MSTest.Core.csproj" />
<!--
This project targets net462 but we want to test using the netstandard content so let's force its resolution.
Resolving using net462 causes lots of tests to fail with MissingMethodException complaining that DataRow property doesn't exist.
-->
<ProjectReference Include="$(RepoRoot)src\TestFramework\Extension\Extension.csproj" SetTargetFramework="TargetFramework=netstandard2.0" />
<ProjectReference Include="$(RepoRoot)src\TestFramework\Extension\Extension.csproj" Condition=" '$(TargetFramework)' != '$(NetStandardNetFrameworkHolder)' " />
<ProjectReference Include="$(RepoRoot)test\TestFramework.ForTestingMSTest\TestFramework.ForTestingMSTest.csproj" />
</ItemGroup>

Expand Down