Skip to content

Haiku: Native support#126805

Open
trungnt2910 wants to merge 1 commit intodotnet:mainfrom
trungnt2910:dev/trungnt2910/haiku-misc-native
Open

Haiku: Native support#126805
trungnt2910 wants to merge 1 commit intodotnet:mainfrom
trungnt2910:dev/trungnt2910/haiku-misc-native

Conversation

@trungnt2910
Copy link
Copy Markdown
Contributor

@trungnt2910 trungnt2910 commented Apr 12, 2026

This is the rest of the changes to the native code of .NET from the initial porting effort in 2023.

Part of #55803.

Copilot AI review requested due to automatic review settings April 12, 2026 06:30
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Haiku-specific handling to ensure requests to load "libc" resolve to the correct system runtime library on Haiku.

Changes:

  • Map "libc" to "libroot.so" when building/running on Haiku in Mono’s dynamic loader shim.

Comment thread src/mono/mono/utils/mono-dl.c Outdated
This is the rest of the changes to the native code of .NET from the
initial porting effort in 2023.
@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/haiku-misc-native branch from 3944abc to 646589b Compare April 12, 2026 06:37
@am11
Copy link
Copy Markdown
Member

am11 commented Apr 12, 2026

Mono portion of this repo is only for mobile and browser/wasm platforms and it will eventually go away when CoreCLR replaces them, which is actively being worked on. For desktop platforms, CoreCLR and NativeAOT are the main focus going forward.

kotlarmilos pushed a commit that referenced this pull request Apr 27, 2026
#127274)

Fixes System.Console.Tests failures on MacCatalyst discovered in
runtime-extra-platforms build
[#1388505](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1388505).

## Failure

**Build**:
[#1388505](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1388505)
(2026-04-21)
**Job**: `maccatalyst-arm64 Release AllSubsets_Mono`  
**Helix job**: `f4caa84e-1526-4c12-a872-6f24ac6f3ba1`  
**Work item**: System.Console.Tests  
**Platform**: MacCatalyst arm64 (also affects maccatalyst-x64)

### Failed tests

Four tests failed with `PlatformNotSupportedException`:

1. `OpenStandardInputHandle_ReturnsValidHandle`
2. `OpenStandardOutputHandle_ReturnsValidHandle`
3. `OpenStandardErrorHandle_ReturnsValidHandle`
4. `OpenStandardHandles_DoNotOwnHandle`

````text
[FAIL] System.Tests.ConsoleTests.OpenStandardInputHandle_ReturnsValidHandle
System.PlatformNotSupportedException : Operation is not supported on this platform.
   at System.ConsolePal.OpenStandardInputHandle()
   at System.Console.OpenStandardInputHandle()
````

### Root cause

The `Console.OpenStandardXXXHandle()` methods throw
`PlatformNotSupportedException` on mobile platforms (iOS, tvOS, Android,
MacCatalyst) because these platforms do not expose the underlying file
handles for standard streams.

The existing tests already had `[PlatformSpecific]` attributes excluding
iOS, tvOS, and Android, but **MacCatalyst was missing** from the
exclusion list. This is an oversight because MacCatalyst has the same
limitation as other Apple mobile platforms.

### Fix

Add `TestPlatforms.MacCatalyst` to the exclusion list (using `&
~TestPlatforms.MacCatalyst`) on all five tests that attempt to use these
APIs, and add it to the inclusion list on the three
"ThrowsOnUnsupportedPlatforms" tests that validate the exception is
thrown.

This makes the skip coverage consistent across all mobile platforms:
- Skip on: iOS, tvOS, MacCatalyst, Android, Browser (where applicable)
- Run on: Windows, Linux, macOS desktop

## Testing

After this fix, the four failing tests will be skipped on MacCatalyst in
the `runtime-extra-platforms` pipeline, matching the behavior on iOS,
tvOS, and Android.

---

> [!NOTE]
> This PR was created by GitHub Copilot after analyzing mobile platform
CI failures in the runtime-extra-platforms pipeline (build 1388505).




> [!NOTE]
> <details>
> <summary>🔒 Integrity filter blocked 1 item</summary>
>
> The following item were blocked because they don't meet the GitHub
integrity level.
>
> - [#126805](#126805)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
>
> To allow these resources, lower `min-integrity` in your GitHub
frontmatter:
>
> ```yaml
> tools:
>   github:
>     min-integrity: approved  # merged | approved | unapproved | none
> ```
>
> </details>


> Generated by [Mobile Platform Failure
Scanner](https://github.com/dotnet/runtime/actions/runs/24774805343/agentic_workflow)
· ● 2.2M ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fruntime+%22gh-aw-workflow-id%3A+mobile-scan%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Mobile Platform Failure Scanner, engine:
copilot, model: claude-sonnet-4.5, id: 24774805343, workflow_id:
mobile-scan, run:
https://github.com/dotnet/runtime/actions/runs/24774805343 -->

<!-- gh-aw-workflow-id: mobile-scan -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kotlarmilos added a commit that referenced this pull request Apr 28, 2026
> [!NOTE]
> This content was generated by GitHub Copilot.

## Summary

Fixes
`System.Net.NameResolution.Functional.Tests.GetHostEntryTest.DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs`
test failure on Android by skipping the test on that platform.

## Background

The test assumes that resolving "localhost" returns only loopback IP
addresses (`127.0.0.1` and `::1`). However, on Android Helix machines
(emulators), the DNS resolution for "localhost" returns actual network
interfaces in addition to loopback addresses, causing the test to fail
with assertions like:

`````
Assert.All() Failure: 5 out of 6 items in the collection did not pass.
[1]: Item:  fe80::e05a:f2ff:fee9:6ae6%47
     Error: Not a loopback address: fe80::e05a:f2ff:fee9:6ae6%47
[2]: Item:  2001:4898:502:2:e05a:f2ff:fee9:6ae6
     Error: Not a loopback address: 2001:4898:502:2:e05a:f2ff:fee9:6ae6
[5]: Item:  10.64.32.211
     Error: Not a loopback address: 10.64.32.211
````

## Changes

Added `[SkipOnPlatform(TestPlatforms.Android, ...)]` attribute to the
failing test, consistent with existing skips for iOS, tvOS, and
MacCatalyst on the same test (which have similar issues).

## Failure Details

**Build:**
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1396313

**Job:** `android-arm64 Release AllSubsets_Mono`

**Helix Work Item:** System.Net.NameResolution.Functional.Tests
- Job ID: `93091357-214b-436d-a5c4-a31ee456a876`
- Console log:
https://helix.dot.net/api/2019-06-17/jobs/93091357-214b-436d-a5c4-a31ee456a876/workitems/System.Net.NameResolution.Functional.Tests/console

**Log excerpt (sanitized):**
````
04-25 00:03:35.029  DOTNET  : [FAIL] System.Net.NameResolution.Tests.GetHostEntryTest.DnsGetHostEntry_LocalHost_ReturnsFqdnAndLoopbackIPs(mode: 0)
04-25 00:03:35.029  DOTNET  : Assert.All() Failure: 5 out of 6 items in the collection did not pass.
04-25 00:03:35.029  DOTNET  : [5]: Item:  10.64.32.211
04-25 00:03:35.029  DOTNET  :      Error: Not a loopback address: 10.64.32.211
`````

## Related

- Existing skip on iOS/tvOS/MacCatalyst: #124079
- Similar Wasi skip: #107339




> [!NOTE]
> <details>
> <summary>🔒 Integrity filter blocked 1 item</summary>
>
> The following item were blocked because they don't meet the GitHub
integrity level.
>
> - [#126805](#126805)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
>
> To allow these resources, lower `min-integrity` in your GitHub
frontmatter:
>
> ```yaml
> tools:
>   github:
>     min-integrity: approved  # merged | approved | unapproved | none
> ```
>
> </details>


> Generated by [Mobile Platform Failure
Scanner](https://github.com/dotnet/runtime/actions/runs/24929356562/agentic_workflow)
· ● 4.1M ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fruntime+%22gh-aw-workflow-id%3A+mobile-scan%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Mobile Platform Failure Scanner, engine:
copilot, model: claude-sonnet-4.5, id: 24929356562, workflow_id:
mobile-scan, run:
https://github.com/dotnet/runtime/actions/runs/24929356562 -->

<!-- gh-aw-workflow-id: mobile-scan -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-meta-mono community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants