From 6d93a1766bbb60d2adc19e43bc94d1f3311eb0a4 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 17 Mar 2016 18:15:39 -0700 Subject: [PATCH] Add all classes to AssemblyLoadContext collection To ensure that the initializer is called before any other code. This is as close to a global init hook as I can find. --- test/csharp/test_Binders.cs | 1 + test/csharp/test_CorePsExtensions.cs | 1 + test/csharp/test_CorePsPlatform.cs | 1 + test/csharp/test_ExtensionMethods.cs | 1 + test/csharp/test_FileSystemProvider.cs | 1 + test/csharp/test_MshSnapinInfo.cs | 1 + test/csharp/test_PSVersionInfo.cs | 1 + test/csharp/test_SecuritySupport.cs | 1 + test/csharp/test_Utils.cs | 1 + 9 files changed, 9 insertions(+) diff --git a/test/csharp/test_Binders.cs b/test/csharp/test_Binders.cs index 6f5a8f7d14..91dc76d25b 100644 --- a/test/csharp/test_Binders.cs +++ b/test/csharp/test_Binders.cs @@ -4,6 +4,7 @@ using System.Management.Automation.Language; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class PSEnumerableBinderTests { [Fact] diff --git a/test/csharp/test_CorePsExtensions.cs b/test/csharp/test_CorePsExtensions.cs index 2a736d7f9b..97d2ee50f7 100644 --- a/test/csharp/test_CorePsExtensions.cs +++ b/test/csharp/test_CorePsExtensions.cs @@ -4,6 +4,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class CorePsExtensionsTests { [Fact] diff --git a/test/csharp/test_CorePsPlatform.cs b/test/csharp/test_CorePsPlatform.cs index 7196862eb3..e36f5aa4f6 100644 --- a/test/csharp/test_CorePsPlatform.cs +++ b/test/csharp/test_CorePsPlatform.cs @@ -6,6 +6,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class PlatformTests { [Fact] diff --git a/test/csharp/test_ExtensionMethods.cs b/test/csharp/test_ExtensionMethods.cs index e22de8be57..134f94b281 100644 --- a/test/csharp/test_ExtensionMethods.cs +++ b/test/csharp/test_ExtensionMethods.cs @@ -4,6 +4,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class PSTypeExtensionsTests { [Fact] diff --git a/test/csharp/test_FileSystemProvider.cs b/test/csharp/test_FileSystemProvider.cs index 2bdcacbfcf..7c33910d89 100644 --- a/test/csharp/test_FileSystemProvider.cs +++ b/test/csharp/test_FileSystemProvider.cs @@ -5,6 +5,7 @@ using Microsoft.PowerShell.Commands; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class FileSystemProviderTests { [Fact] diff --git a/test/csharp/test_MshSnapinInfo.cs b/test/csharp/test_MshSnapinInfo.cs index a283e79956..8a14afb89b 100644 --- a/test/csharp/test_MshSnapinInfo.cs +++ b/test/csharp/test_MshSnapinInfo.cs @@ -5,6 +5,7 @@ using System.Management.Automation; namespace PSTests { // Not static because a test requires non-const variables + [Collection("AssemblyLoadContext")] public class MshSnapinInfoTests { // Test that it does not throw an exception diff --git a/test/csharp/test_PSVersionInfo.cs b/test/csharp/test_PSVersionInfo.cs index ef980475eb..5bd7acb82e 100644 --- a/test/csharp/test_PSVersionInfo.cs +++ b/test/csharp/test_PSVersionInfo.cs @@ -4,6 +4,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class PSVersionInfoTests { [Fact] diff --git a/test/csharp/test_SecuritySupport.cs b/test/csharp/test_SecuritySupport.cs index 962dc66707..33c336308c 100644 --- a/test/csharp/test_SecuritySupport.cs +++ b/test/csharp/test_SecuritySupport.cs @@ -4,6 +4,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class SecuritySupportTests { [Fact] diff --git a/test/csharp/test_Utils.cs b/test/csharp/test_Utils.cs index eb5167780c..65ded34f63 100644 --- a/test/csharp/test_Utils.cs +++ b/test/csharp/test_Utils.cs @@ -4,6 +4,7 @@ using System.Management.Automation; namespace PSTests { + [Collection("AssemblyLoadContext")] public static class UtilsTests { [Fact]