@@ -14,14 +14,17 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework
14
14
using Microsoft . VisualStudio . TestPlatform . ObjectModel ;
15
15
using Microsoft . VisualStudio . TestPlatform . ObjectModel . Adapter ;
16
16
using Microsoft . VisualStudio . TestPlatform . ObjectModel . Client ;
17
+ #if ! NET46
18
+ using System . Runtime . Loader ;
19
+ #endif
17
20
18
21
/// <summary>
19
22
/// Discovers test extensions in a directory.
20
23
/// </summary>
21
24
internal class TestPluginDiscoverer
22
25
{
23
26
#region Fields
24
-
27
+
25
28
#if WINDOWS_UAP
26
29
private static HashSet < string > platformAssemblies = new HashSet < string > ( new string [ ] {
27
30
"MICROSOFT.VISUALSTUDIO.TESTPLATFORM.UNITTESTFRAMEWORK.DLL" ,
@@ -53,22 +56,14 @@ public TestExtensions GetTestExtensionsInformation(
53
56
bool loadOnlyWellKnownExtensions )
54
57
{
55
58
Debug . Assert ( pathToExtensions != null ) ;
56
-
59
+
57
60
var testExtensions = new TestExtensions
58
- {
59
- TestDiscoverers =
60
- new Dictionary < string , TestDiscovererPluginInformation > (
61
- StringComparer . OrdinalIgnoreCase ) ,
62
- TestExecutors =
63
- new Dictionary < string , TestExecutorPluginInformation > (
64
- StringComparer . OrdinalIgnoreCase ) ,
65
- TestSettingsProviders =
66
- new Dictionary < string , TestSettingsProviderPluginInformation > (
67
- StringComparer . OrdinalIgnoreCase ) ,
68
- TestLoggers =
69
- new Dictionary < string , TestLoggerPluginInformation > (
70
- StringComparer . OrdinalIgnoreCase )
71
- } ;
61
+ {
62
+ TestDiscoverers = new Dictionary < string , TestDiscovererPluginInformation > ( StringComparer . OrdinalIgnoreCase ) ,
63
+ TestExecutors = new Dictionary < string , TestExecutorPluginInformation > ( StringComparer . OrdinalIgnoreCase ) ,
64
+ TestSettingsProviders = new Dictionary < string , TestSettingsProviderPluginInformation > ( StringComparer . OrdinalIgnoreCase ) ,
65
+ TestLoggers = new Dictionary < string , TestLoggerPluginInformation > ( StringComparer . OrdinalIgnoreCase )
66
+ } ;
72
67
73
68
74
69
#if ! WINDOWS_UAP
@@ -165,8 +160,12 @@ private void GetTestExtensionsFromFiles(
165
160
try
166
161
{
167
162
var assemblyName = Path . GetFileNameWithoutExtension ( file ) ;
163
+ #if NET46
168
164
assembly = Assembly . Load ( new AssemblyName ( assemblyName ) ) ;
169
-
165
+ #else
166
+ assembly = AssemblyLoadContext . Default . LoadFromAssemblyPath ( file ) ;
167
+ #endif
168
+
170
169
// Check whether this assembly is known or not.
171
170
//if (loadOnlyWellKnownExtensions && assembly != null)
172
171
//{
0 commit comments