Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Add OpenBSD support in System.Net.NetworkInformation - #129279

Merged
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd
Jun 24, 2026
Merged

Add OpenBSD support in System.Net.NetworkInformation#129279
rzikm merged 9 commits into
dotnet:mainfrom
sethjackson:port-sys-netinfo-openbsd

Conversation

@sethjackson

@sethjacksonsethjackson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

There is already support in System.Native for this. Just need to enable it in the managed layer for OpenBSD.

Note that FreeBSD includes what appears to be a spurious FreeBSD specific Interop.Libraries.cs file which only contains the MsQuic constant and since that doesn't appear to be used in System.Net.NetworkInformation I haven't included it here and msquic won't work as it stands on OpenBSD today anyways.

Contributes to #124911.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@am11

am11 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Did you try running its tests on the device? If not, bootstrap docs in main branch have steps to build single library with zip archive, copy the zip archive and testhost from host to OpenBSD machine and invoke RunTests.sh command mentioned in the docs.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

I did not run tests but I’ll look at the docs and run them and post back.

@sethjackson

sethjackson commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

What is involved in updating that to 7.9 besides updating the cross root FS stuff in dotnet/arcade?

On 7.8 the tests fail with the following:

System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.

A longer trace:

System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing [FAIL]
System.PlatformNotSupportedException : System.Net.NetworkInformation is not supported on this platform.
Stack Trace:
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0/System.Net.NetworkInformation.notsupported.cs(548,0): at System.Net.NetworkInformation.TcpConnectionInformation..ctor()
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SimpleTcpConnectionInformation.Unix.cs(8,0): at System.Net.NetworkInformation.SimpleTcpConnectionInformation..ctor(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpState state)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(265,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseTcpConnectionInformationFromLine(String line)
/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs(71,0): at System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpConnectionsFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)
/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/ConnectionsParsingTests.cs(48,0): at System.Net.NetworkInformation.Tests.ConnectionsParsingTests.ActiveTcpConnectionsParsing()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/runtime/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs(1188,0): at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

So not entirely sure what I did wrong here? I did the cross build and test packaging from my branch that has this patch.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

@am11

am11 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I was struggling to get this to run on my system then I realized that I was on 7.9 which was recently released but cross build infra is on 7.8.

It is best to start with "lowest version which is not out of support" and that version is 7.8. What is the error on 7.9? Lets discuss it in main thread #124911.

PlatformNotSupportedException

When in doubt, piggyback on git grep -i freebsd -- ':/src/libraries/System.Net.NetworkInformation'

@sethjackson

sethjackson commented Jun 13, 2026

Copy link
Copy Markdown
ContributorAuthor

So I need to add openbsd to <TargetFrameworks> so that the <TargetPlatformIdentifier> gets set properly with:

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

So that the Unix/BSD specific files get included in the build.

However when I do that I get the following:

Build FAILED.
/runtime/artifacts/obj/System.Net.NetworkInformation/Debug/net11.0-openbsd/System.Net.NetworkInformation.AssemblyInfo.cs(30,12): error CA1418: The platform 'openbsd' is not a known platform name (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418) [/runtime/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj::TargetFramework=net11.0-openbsd]

And I'm not really sure how to fix this. I trapsed around in the linked docs and in the MSBuild repo but I didn't see anything FreeBSD specific that would make this work so not sure how to fix this for OpenBSD. Any ideas @am11?

@am11

am11 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add openbsd after

<SupportedPlatformCondition="'$(TargetPlatformIdentifier)' == 'haiku'"Include="Haiku" />

We don't have OSPlatform.OpenBSD API yet, so any upcoming platform which is not yet released needs to be created manually there, so it can call OSPlatform.Create("OPENBSD") instead of OSPlatform.OpenBSD (FreeBSD has mileage in dotnet since 2016-17, so it doesn't have those issues; illumos/solaris/haiku are on this not-yet-release plan).

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Got it. That fixed it. I didn't see FreeBSD in that file so I didn't add it originally and OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

I'm assuming I should add the change to versioning.targets here in this PR correct? I don't see that file in http://github.com/dotnet/arcade

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Yes, this PR is the correct place for it; it's the first time we are building a platform-aware library where this validation kicks in.

Also, when you will run the tests, some of them will fail, you may need to sprinkle some TestPlatforms.OpenBSD attribute condition or if (!OSPlatform.Create("OPENBSD"))in C# code to skip them. You will need to make some understanding why those failed/skipped and whether that's expected. In case that's not expected (there is some bug), you can either fix it as part of this PR or open an issue then add this attribute [ActiveIssue("https://github.com/dotnet/runtime/issues/<your issue number>", TestPlatforms.OpenBSD)].

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

OperatingSystem.OpenBSD exists but I forgot it is internal vs public.

There was a typo in my comment I've edited; it was meant to be OSPlatform.OpenBSD and OSPlatform.Create("OPENBSD).

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I don't see that file in http://github.com/dotnet/arcade

Arcade shared directory is eng/common which gets autosync by bot: https://github.com/dotnet/runtime/blob/a3359b88167e537ef31281887bb259461391f8f6/eng/common/README.mdversioning.targets is outside of it.

@am11

am11 commented Jun 15, 2026

Copy link
Copy Markdown
Member

You can merge sethjackson#1 and that change will show up here. With those changes, all tests are appropriately skipped and others passing.

/home/am11/th/artifacts/bin/testhost/net11.0-openbsd-Debug-x64/dotnet exec --runtimeconfig System.Net.NetworkInformation.Functional.Tests.runtimeconfig.json --depsfile System.Net.NetworkInformation.Functional.Tests.deps.json xunit.console.dll System.Net.NetworkInformation.Functional.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
~/system.netinfo ~/system.netinfo
Discovering: System.Net.NetworkInformation.Functional.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Net.NetworkInformation.Functional.Tests (found 64 of 99 test cases)
Starting: System.Net.NetworkInformation.Functional.Tests (parallel test collections = on [5 threads], stop on fail = off)
Finished: System.Net.NetworkInformation.Functional.Tests
=== TEST EXECUTION SUMMARY ===
System.Net.NetworkInformation.Functional.Tests Total: 229, Errors: 0, Failed: 0, Skipped: 0, Time: 1.820s

@sethjackson
sethjacksonforce-pushed the port-sys-netinfo-openbsd branch 2 times, most recently from c45029e to cf3a04aCompareJune 15, 2026 22:38
Implement missing pieces for NetworkInformation
@sethjackson

sethjackson commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

Oh nice! I doubt I would have figured that out myself. I merged it. Thanks!

One thing I noticed is that this file:
https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs

Is missing the OpenBSD constant and is therfore missing from AnyUnix as well. I'm not sure that it matters or not but just wanted to point it out as otherwise I wasn't sure where the TestPlatforms.OpenBSD constant was coming from.

@am11

am11 commented Jun 16, 2026

Copy link
Copy Markdown
Member

It's coming from arcade SDK: https://github.com/dotnet/arcade/blob/5f63985fe82894604956e653d43c161ebbc1b576/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26

src/tests: runtime tests (coreclr-vm,gc,jit,aot etc.).
src/libraries/<name>/tests: runtime libraries tests.

We can add OpenBSD in runtime tests later on, bootstrap docs cover both.

@sethjackson

Copy link
Copy Markdown
ContributorAuthor

Anything else that is needed before this can be merged?

@am11
am11 requested review from janvorli, rzikm and wfurtJune 16, 2026 16:27
@am11am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 16, 2026

@rzikmrzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would prefer if also somebody else from @dotnet/ncl gave this a look

@rzikm
rzikm requested a review from a teamJune 17, 2026 06:47
@am11am11 closed this Jun 19, 2026
@am11am11 reopened this Jun 19, 2026
@am11

am11 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Remaining failures are unrelated; random timeouts. cc @dotnet/ncl

@rzikm

Copy link
Copy Markdown
Member

/ba-g Test failures are unrelated timeouts

@rzikm
rzikm merged commit 62040af into dotnet:mainJun 24, 2026
119 of 122 checks passed
@sethjackson
sethjackson deleted the port-sys-netinfo-openbsd branch June 24, 2026 15:25
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jun 25, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
There is already support in `System.Native` for this. Just need to
enable it in the managed layer for OpenBSD.
Note that FreeBSD includes what appears to be a spurious FreeBSD
specific `Interop.Libraries.cs` file which only contains the `MsQuic`
constant and since that doesn't appear to be used in
`System.Net.NetworkInformation` I haven't included it here and `msquic`
won't work as it stands on OpenBSD today anyways.
Contributes to #124911.
---------
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 26, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Netos-openbsdOpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sethjackson@am11@rzikm