[wasm] Modify System.Net.Request to throw PNSE on Browser WASM (#40274)
authorMaxim Lipnin <v-maxlip@microsoft.com>
Tue, 4 Aug 2020 08:01:22 +0000 (11:01 +0300)
committerGitHub <noreply@github.com>
Tue, 4 Aug 2020 08:01:22 +0000 (08:01 +0000)
* [wasm] Modify System.Net.Request to throw PNSE on Browser WASM

* [wasm] Re-enable System.ComponentModel.EventBasedAsync.Tests.BackgroundWorkerTests.TestFinalization test

* Make the CS0809 build warning depend on if PNSE assembly is going to be generated

* Update src/libraries/System.Net.Requests/src/System.Net.Requests.csproj

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* Remove redundant condition

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
src/libraries/System.ComponentModel.EventBasedAsync/tests/BackgroundWorkerTests.cs
src/libraries/System.Net.Requests/src/Resources/Strings.resx
src/libraries/System.Net.Requests/src/System.Net.Requests.csproj
src/libraries/System.Net.Requests/tests/AssemblyInfo.cs
src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj

index 8ba0dcb..7bdfb4d 100644 (file)
@@ -327,7 +327,6 @@ namespace System.ComponentModel.EventBasedAsync.Tests
         }
 
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
-        [ActiveIssue("https://github.com/dotnet/runtime/issues/38283", TestPlatforms.Browser)]
         public void TestFinalization()
         {
             // BackgroundWorker has a finalizer that exists purely for backwards compatibility
index cb28aec..5240ec2 100644 (file)
   <data name="net_invalid_host" xml:space="preserve">
     <value>The specified value is not a valid Host header string.</value>
   </data>
+  <data name="SystemNetRequests_PlatformNotSupported" xml:space="preserve">
+    <value>System.Net.Requests is not supported on this platform.</value>
+  </data>
 </root>
index 96471ee..b21e3f4 100644 (file)
@@ -4,7 +4,11 @@
     <TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
     <Nullable>enable</Nullable>
   </PropertyGroup>
-  <ItemGroup>
+  <PropertyGroup>
+    <GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.SystemNetRequests_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
+    <NoWarn Condition="'$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(NoWarn);CS0809</NoWarn>
+  </PropertyGroup>
+  <ItemGroup Condition="'$(TargetsBrowser)' != 'true'">
     <Compile Include="System\Net\AuthenticationManager.cs" />
     <Compile Include="System\Net\Authorization.cs" />
     <Compile Include="System\Net\FileWebRequest.cs" />
@@ -77,7 +81,7 @@
              Link="Common\System\Net\ContextAwareResult.Windows.cs" />
     <Compile Include="System\Net\WebExceptionPal.Windows.cs" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' ">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Compile Include="$(CommonPath)System\Net\ContextAwareResult.Unix.cs"
              Link="Common\System\Net\ContextAwareResult.Unix.cs" />
     <Compile Include="System\Net\WebExceptionPal.Unix.cs" />
index 527dabb..67d13a0 100644 (file)
@@ -4,4 +4,4 @@
 using Xunit;
 
 [assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
-[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/38283", TestPlatforms.Browser)]
+[assembly: SkipOnMono("System.Net.Requests is not supported on Browser.", TestPlatforms.Browser)]
index e0c47d0..ecb8a78 100644 (file)
@@ -4,6 +4,7 @@
     <IncludeRemoteExecutor>true</IncludeRemoteExecutor>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
     <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
+    <IgnoreForCI Condition="'$(TargetOS)' == 'Browser'">true</IgnoreForCI>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="AssemblyInfo.cs" />