WASM: Enable System.Reflection.MetadataLoadContext tests (#39651)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 21 Jul 2020 08:44:44 +0000 (10:44 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2020 08:44:44 +0000 (10:44 +0200)
`Tests run: 559, Errors: 0, Failures: 0, Skipped: 0. Time: 5.4221639s`

eng/testing/tests.mobile.targets
src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/MetadataLoadContext/PathAssemblyResolver.cs
src/libraries/tests.proj

index 284ae301d888809d609332994f252e588454129f..70887c7ac77f6f8621250709bc29f169c93ea35a 100644 (file)
       <ExtraAssemblies Include="$(PublishDir)System.Xml.dll" />
       <ExtraAssemblies Include="$(PublishDir)WindowsBase.dll" />
     </ItemGroup>
+    <ItemGroup Condition="'$(AssemblyName)' == 'System.Reflection.MetadataLoadContext.Tests'">
+      <WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Private.CoreLib.dll" />
+      <WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Reflection.MetadataLoadContext.Tests.dll" />
+      <WasmFilesToIncludeInFileSystem Include="$(PublishDir)mscorlib.dll" />
+    </ItemGroup>
     <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
     <WasmAppBuilder
       AppDir="$(BundleDir)"
index 7b827af4ff9c6aa470ec334c53cd26fc99b8b3be..501e40c72ecb47abdcb5380dfa603ab22f67dc62 100644 (file)
@@ -62,6 +62,12 @@ namespace System.Reflection.Tests
             // Obtain this test class
             string thisAssemblyPath = typeof(MetadataLoadContextTests).Assembly.Location;
 
+            if (PlatformDetection.IsBrowser)
+            {
+                // prepends slash as Assembly.Location only contains the file name on browser (https://github.com/dotnet/runtime/issues/39650)
+                thisAssemblyPath = "/" + thisAssemblyPath;
+            }
+
             var resolver = new PathAssemblyResolver(new string[] { coreAssemblyPath, thisAssemblyPath });
             using (MetadataLoadContext lc = new MetadataLoadContext(resolver, TestUtils.GetNameOfCoreAssembly()))
             {
index 7b9b0de3bed08ed3d3bfd690225c461a703319dd..4ea05eaec8c961cdddc12319efabd1eb4564cdfe 100644 (file)
@@ -42,7 +42,6 @@
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml\tests\XmlSerializer\ReflectionOnly\System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml\tests\XmlSerializer\System.Xml.XmlSerializer.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection.Metadata\tests\System.Reflection.Metadata.Tests.csproj" />
-    <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection.MetadataLoadContext\tests\System.Reflection.MetadataLoadContext.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection\tests\CoreCLR\System.Reflection.CoreCLR.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection\tests\System.Reflection.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Security.Permissions\tests\System.Security.Permissions.Tests.csproj" />