Skip to content

Commit d03f3d0

Browse files
committed
Disable xUnit's app domains
xUnit infuriatingly defaults to using its own custom app domains (and thus shadow copying of assemblies), which completely messes up our assembly locations, our ability to find modules such as PSReadLine, and resolving types from PSReadLine too. We were not actually configuing xUnit correctly either.
1 parent 4e8ff40 commit d03f3d0

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ internal static bool TryGetPSReadLineProxy(
8989
{
9090
readLineProxy = null;
9191
logger.LogTrace("Attempting to load PSReadLine");
92+
Console.WriteLine($"Module path is {_psReadLineTestModulePath}");
9293
using (var pwsh = PowerShell.Create())
9394
{
9495
pwsh.Runspace = runspace;
@@ -101,6 +102,7 @@ internal static bool TryGetPSReadLineProxy(
101102
if (psReadLineType == null)
102103
{
103104
logger.LogWarning("PSConsoleReadline type not found: {Reason}", pwsh.HadErrors ? pwsh.Streams.Error[0].ToString() : "<Unknown reason>");
105+
Console.WriteLine("Failed to GetType but no PowerShell error");
104106
return false;
105107
}
106108

test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<None Update="xunit.runner.json">
26-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27-
</None>
25+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
2826
</ItemGroup>
2927
</Project>

test/PowerShellEditorServices.Test.E2E/xunit.runner.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"parallelizeTestCollections": false
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
3+
"appDomain": "denied",
4+
"parallelizeTestCollections": false,
5+
"methodDisplay": "method"
36
}
4-

test/PowerShellEditorServices.Test/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
3+
34
<PropertyGroup>
45
<TargetFrameworks>net6.0;netcoreapp3.1;net461</TargetFrameworks>
56
<AssemblyName>Microsoft.PowerShell.EditorServices.Test</AssemblyName>
67
<TargetPlatform>x64</TargetPlatform>
78
</PropertyGroup>
9+
810
<PropertyGroup>
911
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1012
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
1113
</PropertyGroup>
14+
1215
<ItemGroup>
1316
<ProjectReference Include="..\..\src\PowerShellEditorServices\PowerShellEditorServices.csproj" />
1417
<ProjectReference Include="..\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj" />
1518
</ItemGroup>
19+
1620
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
1721
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.0-preview.3" />
1822
</ItemGroup>
23+
1924
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
2025
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.6" />
2126
</ItemGroup>
27+
2228
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
2329
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />
2430
</ItemGroup>
31+
2532
<ItemGroup>
2633
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
2734
<PackageReference Include="xunit" Version="2.4.1" />
@@ -30,14 +37,21 @@
3037
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.19.2" />
3138
<DotNetCliToolReference Include="dotnet-xunit" Version="2.4.0-beta.1.build3958" />
3239
</ItemGroup>
40+
3341
<ItemGroup>
3442
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
3543
</ItemGroup>
44+
3645
<ItemGroup>
3746
<None Include="Fixtures\**">
3847
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3948
</None>
4049
</ItemGroup>
50+
51+
<ItemGroup>
52+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
53+
</ItemGroup>
54+
4155
<PropertyGroup Condition=" '$(TargetFramework)' != 'net461' ">
4256
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
4357
</PropertyGroup>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
3+
"appDomain": "denied",
24
"parallelizeTestCollections": false,
35
"methodDisplay": "method"
46
}

0 commit comments

Comments
 (0)