mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Merge pull request #850 from PowerShell/andschwa/fix-xunit
Re-enable xUnit tests on Linux
This commit is contained in:
commit
a655b439bc
6 files changed
+23
-7
No files matched your search
+9
-1
@@ -522,7 +522,15 @@ namespace System.Management.Automation
|
||||
if (!IsInitialized)
|
||||
{
|
||||
var psAsmLoadContext = new PowerShellAssemblyLoadContext(basePaths);
|
||||
AssemblyLoadContext.InitializeDefaultContext(psAsmLoadContext);
|
||||
try
|
||||
{
|
||||
AssemblyLoadContext.InitializeDefaultContext(psAsmLoadContext);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// We may not be able to set the default context. If we're under the
|
||||
// xUnit test harness, it has already been set.
|
||||
}
|
||||
IsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,9 @@ namespace System.Management.Automation
|
||||
_psLoadContext = AssemblyLoadContext.Default as PowerShellAssemblyLoadContext;
|
||||
if (_psLoadContext == null)
|
||||
{
|
||||
throw new InvalidOperationException(ParserStrings.InvalidAssemblyLoadContextInUse);
|
||||
// The default load context may not be ours. This can happen during,
|
||||
// for instance, xUnit testing.
|
||||
_psLoadContext = new PowerShellAssemblyLoadContext(String.Empty);
|
||||
}
|
||||
}
|
||||
return _psLoadContext;
|
||||
|
||||
Reference in new issue
Block a user