Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Modify System.Net.NetworkInformation to throw PNSE #38928

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@
<data name="net_PInvokeError" xml:space="preserve">
<value>An error was encountered while querying information from the operating system.</value>
</data>
<data name="net_NetworkInformation_PlatformNotSupported" xml:space="preserve">
<value>System.Net.NetworkInformation is not supported on this platform.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PropertyGroup>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.net_NetworkInformation_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsBrowser)' != 'true'">
<Compile Include="System\Net\NetworkInformation\DuplicateAddressDetectionState.cs" />
<Compile Include="System\Net\NetworkInformation\GatewayIPAddressInformation.cs" />
<Compile Include="System\Net\NetworkInformation\GatewayIPAddressInformationCollection.cs" />
Expand Down Expand Up @@ -122,7 +125,7 @@
Link="Common\Interop\Windows\WinSock\Interop.WSAIoctl.cs" />
</ItemGroup>
<!-- Unix -->
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' ">
<ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
<Compile Include="System\Net\NetworkInformation\IPAddressUtil.cs" />
<Compile Include="System\Net\NetworkInformation\NetworkFiles.cs" />
<Compile Include="System\Net\NetworkInformation\SimpleGatewayIPAddressInformation.Unix.cs" />
Expand Down Expand Up @@ -154,7 +157,7 @@
Link="Common\System\IO\RowConfigReader.cs" />
</ItemGroup>
<!-- Linux -->
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' or '$(TargetsBrowser)' == 'true' ">
<ItemGroup Condition="'$(TargetsLinux)' == 'true'">
<Compile Include="System\Net\NetworkInformation\ExceptionHelper.Linux.cs" />
<Compile Include="System\Net\NetworkInformation\LinuxIcmpV4Statistics.cs" />
<Compile Include="System\Net\NetworkInformation\LinuxIcmpV6Statistics.cs" />
Expand Down Expand Up @@ -221,7 +224,7 @@
<Compile Include="$(CommonPath)Interop\FreeBSD\Interop.Libraries.cs"
Link="Common\Interop\FreeBSD\Interop.Libraries.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' or '$(TargetsBrowser)' == 'true' OR '$(TargetsFreeBSD)' == 'true'">
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' or '$(TargetsFreeBSD)' == 'true'">
<Compile Include="System\Net\NetworkInformation\NetworkAddressChange.Unix.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.NetworkChange.cs"
Link="Common\Interop\Unix\System.Native\Interop.NetworkChange.cs" />
Expand All @@ -248,11 +251,11 @@
<Reference Include="System.Threading.Overlapped" />
<Reference Include="System.Threading.ThreadPool" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true'">
<ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.Threading.Thread" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsLinux)' == 'true' or '$(TargetsBrowser)' == 'true' OR '$(TargetsFreeBSD)' == 'true'">
<ItemGroup Condition="'$(TargetsLinux)' == 'true' or '$(TargetsFreeBSD)' == 'true'">
<Reference Include="System.Threading.Timer" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Xunit;

[assembly: SkipOnMono("System.Net.NetworkInformation is not supported on wasm", TestPlatforms.Browser)]
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<!-- Shared code with src assembly -->
<Compile Include="..\..\src\System\Net\NetworkInformation\StringParsingHelpers.Addresses.cs"
Link="SharedSource\StringParsingHelpers.Addresses.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void SerializeHugeObjectGraphs(int limit)
[SkipOnCoreClr("Takes too long on Checked", RuntimeConfiguration.Checked)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34008", TestPlatforms.Linux, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34753", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well.

[MemberData(nameof(BasicObjectsRoundtrip_MemberData))]
public void ValidateBasicObjectsRoundtrip(object obj, FormatterAssemblyStyle assemblyFormat, TypeFilterLevel filterLevel, FormatterTypeStyle typeFormat)
{
Expand Down Expand Up @@ -187,6 +188,7 @@ public void ValidateDeserializationOfObjectWithGenericTypeWhichGenericArgumentHa
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34008", TestPlatforms.Linux, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34753", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akoeplinger this is one of the tests we would end up disabling after BinaryFormatter is killed on WASM.

Maybe we want to update to use conditional with PlatformDetecion.IsBinaryFormatterSupported

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@safern yeah, feel free to send a follow up PR for that :)

public void RoundtripManyObjectsInOneStream()
{
object[][] objects = SerializableObjects_MemberData().ToArray();
Expand Down
1 change: 0 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(RunDisabledWasmTests)' != 'true'">
<!-- Builds and runs but fails hard enough to not produce any output XML -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.NetworkInformation\tests\FunctionalTests\System.Net.NetworkInformation.Functional.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.Tests.csproj" />
<!-- Builds currently do not pass -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.VisualBasic.Core\tests\Microsoft.VisualBasic.Core.Tests.csproj" />
Expand Down