Skip to content

Commit

Permalink
[wasm] Modify System.Net.Request to throw PNSE on Browser WASM (#40274)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
MaximLipnin and akoeplinger committed Aug 4, 2020
1 parent 8953bab commit 4c0ebbd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ public void DisposeTwiceShouldNotThrow()
}

[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
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/System.Net.Requests/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,7 @@
<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>
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Net.Requests/tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down

0 comments on commit 4c0ebbd

Please sign in to comment.