Repository navigation
Open
Labels
area-InfrastructureuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Summary
.NET currently supports Android (linux-bionic) and the Apple mobile platforms (ios-*, tvos-*, maccatalyst-*), but not OpenHarmony / HarmonyOS. OpenHarmony is an open-source operating system for phones, tablets, and IoT devices, and HarmonyOS NEXT is the commercial distribution built on it. Adding .NET support would allow C#/.NET applications and libraries to run on this platform.
This issue tracks the overall porting effort. The work is split into a series of PRs so each piece can be reviewed independently.
Scope
- Runtime sandbox fixes — OpenHarmony app sandboxes differ from a plain Linux environment in ways that break .NET at startup or at runtime:
/tmpis mounted read-only; shared-memory files must honorTMPDIR.- The
get_mempolicy/mbindsyscalls are blocked by the sandbox's seccomp policy, so the GC NUMA probe SIGSYS-crashes the process at startup. - The sysroot's pthread lacks robust-mutex support, so
NamedMutexmust use the shared-memory-file implementation. - Tracked by: Use the process temp directory for shared memory on OpenHarmony #132827 (first PR of the series, currently ready for review).
- Build infrastructure —
-os linux-ohossupport: RID graph entry, NDK/sysroot toolchain plumbing, and CI cross-build legs mirroringlinux-bionic. - Runtime (CoreCLR/Mono) enablement — platform-level bring-up, PAL adjustments, and validation on OpenHarmony devices/emulators.
- Tests & validation — targeted test legs for the
linux-ohosRID.
Approach
- Follow the existing
linux-bionic(Android) andlinux-muslpatterns for cross-compilation and RID plumbing. - Keep every PR independently reviewable and a no-op on existing platforms: new behavior is guarded by
TARGET_OHOS, which is only defined when the new target is selected.
Open questions
- Which HarmonyOS API level and NDK version to target.
- Whether to support both OpenHarmony (open source) and HarmonyOS NEXT (commercial) from the start.
- Mono vs CoreCLR prioritization for the first milestone.
Note
This issue was authored with AI assistance (Copilot/agent tooling) under the repository owner's direction.
Reacted by Varorbc
Metadata
Metadata
Assignees
Labels
area-InfrastructureuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Type
Projects
- StatusShow more project fieldsNo status
Activity
dotnet-policy-service commentedon Aug 27, 2026
Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.
huoyaoyuan commentedon Aug 28, 2026
Already tracked at #103627.
Add post-PR#132827 OHOS upstream PR plan
Add OHOS PR plan restructured on the OpenBSD/Haiku landing model
springmin commentedon Sep 10, 2026
Milestone update — first
openharmony-arm64release + device-verified.Released (2026-09-10): all three forks now publish under the
openharmony-arm64RID (the rename requested in review):springmin/sdk-ohosv11.0.100-rc.1.26451.109-ohos—dotnet-sdk-…-openharmony-arm64.tar.gz(160MB)springmin/runtime-ohosv11.0.0-rc.1.26451.109-ohos— runtime / NativeAOT / ILCompiler / Crossgen2 packsspringmin/aspnetcore-ohosv11.0.0-rc.1.26451.109-ohosDevice verification (HarmonyOS, aarch64):
dotnet --inforeportsRID: openharmony-arm64;dotnet new/build/runworks end-to-end..codesign: fixed a release-blocking issue where shipped signatures were rejected on device (EPERM). Signing passes now force re-sign every ELF (selfsign --force); the republished tarball'scscexecutes on device.Upstream PRs:
ohos→openharmonyrename and all review items) — awaiting re-review.Next: continue the upstream PR series (sysroot compile fixes, NativeAOT BuildIntegration, SDK RID support) per the plan posted in the fork docs.
Note
This comment was drafted with AI assistance (agent tooling) under the reporter's direction; release and device results were verified by the reporter.
springmin commentedon Sep 11, 2026
Follow-up (2026-09-12): released assets corrected + independently verified.
Asset fixes (re-uploaded; verified after re-download):
runtime-ohosMicrosoft.NETCore.App.Runtime.ohos-arm64.11.0.0-rc.1.26451.109.nupkg— the released reassembly had droppedruntimes/ohos-arm64/lib/net11.0/System.Private.CoreLib.dll, so AOT publish failed (MSB4018+FileNotFoundException); restored (82,705,719 → 91,029,763 B).runtime-ohosMicrosoft.DotNet.ILCompiler.11.0.0-rc.1.26451.109.nupkg— restored theohosRID mapping in the ILCompiler targets andruntime.json; without it the legacy toolchain fails withTarget OS 'ohos' is not supported.runtime-ohosaspnetcore-runtime-11.0.0-rc.1.26451.109-ohos-arm64.tar.gz— pruned 3 stale accumulatedMicrosoft.NETCore.Appframeworks (67.5 → 18.7 MB); host + frameworks verified on device.Verification:
RuntimeListdeclarations satisfied, SPC present, no stale RID references.ohos-full-buildrun 34612494983 succeeded with the fixedbuild-ohos-all.shcondition (reassembly now runs only for missing/empty/corrupt packs) — the produced runtime pack is correct (RuntimeList 0 missing, R2R CoreLib in place, functional files byte-identical to the released pack).Known gap (found while testing):
PublishReadyToRunis rejected forohos-arm64/openharmony-arm64withNETSDK1095:ResolveReadyToRunCompilers.GetCrossgen2TargetOShas noohosin its portable-platform list and the RID graph intentionally does not inheritlinux. Fix = sdk-ohos task patch + SDK rebuild; tracking as follow-up.Upstream PRs:
Note
This comment was drafted with AI assistance (agent tooling) under the reporter's direction; release and device results were verified by the reporter.
springmin commentedon Sep 12, 2026
Follow-up (2026-09-12):
PublishReadyToRunnow works end-to-end on device — the gap from the previous comment is closed.Root causes (two, stacked):
ResolveReadyToRunCompilers.GetCrossgen2TargetOShad noohos/openharmonyin its portable-platform list and the RID graph intentionally keeps them standalone (nolinuxinheritance), soPublishReadyToRunfailed withNETSDK1095. Fixed in sdk-ohos (f00cb86389) and shipped in the rebuilt SDK.Microsoft.NETCore.App.Crossgen2.<rid>pack was a trimmed single-file publish: ILLink strips interface-dispatched methods (CustomAttributeTypeProvider.GetPrimitiveTypefromILCompiler.TypeSystem.dll— the same class of issue as NativeAOT app startup SIGSEGV after #132787 (R2R 27.1 unboxing stubs) — null TypeManager in InitializeModules #133296) and the bootstrap-layout publish does not carry the framework, so the tool failed at startup on device (TypeLoadException/ missing closure). Fixed in sdk-ohos by re-publishingcrossgen2_publishas an untrimmed split layout (PublishSingleFile=false,PublishTrimmed=false) and reassembling the pack (framework overlay from the runtime pack +runtimepackdeps entry), mirroring the ilc split-publish handling that has been device-verified since the earlier rounds (710f6e9d,7d61d65a).Verification:
ohos-full-buildrun 34670280963 succeeded (openharmony-arm64).PublishReadyToRun=true): publish rc=0 (r2rohfix.dll4,608 B IL → 6,656 B R2R) and device run rc=0:Released assets updated (re-download verified):
Microsoft.NETCore.App.Crossgen2.openharmony-arm64.11.0.0-rc.1.26451.109.nupkg— 7,948,483 → 23,759,473 B (untrimmed split layout + framework).dotnet-crossgen2-11.0.0-rc.1.26451.109-openharmony-arm64.tar.gz— 7,613,187 → 8,143,875 B (refreshed from the same layout).Microsoft.AspNetCore.App.Runtime.openharmony-arm64+aspnetcore-runtime-…-openharmony-arm64.tar.gz— were missing from the release; uploaded.Legacy
ohosRID: the legacy SDK tarball received the R2R fix backported (task assembly swap); the legacy crossgen2 pack stays frozen (the legacy RID is no longer built on the current branch). One observation resolved:RuntimeInformation.RuntimeIdentifierreportingohos-arm64on the test device traced toDOTNET_ROOTpointing at the legacyohosSDK (its hostfxr predates the rename); with the rebuilt SDK the same app reportsopenharmony-arm64correctly.Upstream PRs: #132953 — approved, blocked only on unrelated infra checks; #132827 — awaiting re-review.
Note
This comment was drafted with AI assistance (agent tooling) under the reporter's direction; release and device results were verified by the reporter.
springmin commentedon Sep 14, 2026
Plan update: restructured on the BSD/Haiku landing model.
Sharing the reorganized upstream plan for stacked-PR visibility.
Open PRs (status)
openharmony(the rename is already on the branch); a small follow-up commit (comment fixes + one test-path fix) was pushed on 09-13. Awaiting re-review.Remaining runtime PRs (submission order; one concern each, OpenBSD/Haiku granularity)
N1
clrfeatures.cmake· N2pal/src/configure.cmake+ CMakeLists · N3zstd.cmake· N4libs/CMakeLists.txt+extra_libs.cmake· N5apphost/static/CMakeLists.txt· N6 canceled (inotify_init1is not trapped) · N7pal_process.c(close_range guard) · N8pal_interfaceaddresses.c(ethtool speed) · N9clrconfigvalues.h(W^X default off; device-verified rationale) · N10crossgen-corelib.proj· N11Native.Unix.targets· N12SingleEntry.targets· N13 packs (targetingpacks.targets,ds-portable-rid.c, sfxproj R2R-off,ILCompiler.pkgproj) · N14eng/native/tryrun.cmake· N15 libraries TFM mapping (Directory.Build.props/targets+ sfx + shims) · N16System.Console.csproj.SDK (split by layer): S1a RID data → S1b environment defaults → S1c codesign (reviewer-gated; default downstream — the enforcement is HarmonyOS-commercial-only). aspnetcore: A1 (RID lists + NativeAOT-for-ohos disable). CI leg: last, modeled on the OpenBSD leg (#130761).
Open for reviewer input
Microsoft.NET.ILLink.targets— its own tools/ PR, or fold into N12?The full plan (per-PR rationale, constraints, post-merge cleanups) is maintained on the fork branch: https://github.com/springmin/runtime-ohos/blob/feature/openharmony/docs/plans/2026-09-07-ohos-pr-plan-bsd-haiku-model.md
docs: mark the dotnet#132866 plan post as done
audit §32: upstream-gated follow-ups prepared as fork branches + patches
docs: refresh the upstream state to 2026-10-01
docs: register the reviewer threads' other-work items and our open ac…
docs: upstream opening drafts for dotnet#132827/dotnet#132953/dotnet#…
Add OpenHarmony/HarmonyOS build infrastructure (#132953)
springmin commentedon Oct 20, 2026
Progress update — infrastructure and the first runtime PRs have landed
Since the plan update in September, the landing has started following the sequence listed there.
Merged
TargetOS=ohos); unsupported NUMA calls excluded (2026-09-26).clrfeatures.cmake).pal/src/configure.cmake+CMakeLists.txt).apphost/static/CMakeLists.txt), 2026-10-20.Open
qsortworkaround for zstd.EnableWriteXorExecute=0(the sandbox deniesPROT_EXECon the file-backed mappings the W^X allocator uses); approved, CI finishing.eng/native/tryrun.cmake.Closed as not needed
Next in the queue (rolling, 3–4 in flight)
N7
pal_process.c(close_range guard) · N10crossgen-corelib.proj· N11/N12 AOT targets · N13 packs · N15 libraries TFM groups · N16System.Console.csproj. Each branch is rebased onto the currentmainbefore submission. The granularity/sequence from the previous update is being followed as listed.Open items
Microsoft.NET.ILLink.targets— its owntools/PR, or folded into N12? If there is no preference, we will submit it as a separatetools/PR after N12.Note
This comment was drafted with AI assistance (agent tooling) under the author's direction.
docs: record the dotnet#132866 progress comment (6285162682)
springmin commentedon Oct 20, 2026
Consolidation question for the three open native PRs + remaining plan
Following @am11's batching guidance from #136132, the runtime port is now grouped as substantial batches: #136185 (NativeAOT + packs), #136186 (libraries TFM + console), #136187 (System.Native
close_range).Three earlier one-liners are still open and have not been reviewed yet:
qsortworkaround for zstdShould these three be consolidated into one "native libs fixes" PR, or kept as they are? They are already open and focused; I am happy to close them and submit a single combined PR if that is preferred.
Remaining runtime work, for visibility:
Note
This comment was drafted with AI assistance (agent tooling) under the author's direction.
docs: dotnet#132866 consolidation question posted; SDK branches rebased
springmin commentedon Oct 21, 2026
Following up on the codesign question from the September plan update (S1c in the SDK).
The signer — an MSBuild task that applies an ELF
.codesignsection to build and publish outputs, plus the targets hook and the resource strings — is currently kept downstream. A branch is ready (springmin/sdk-ohospr/ohos-sdk-codesign) if you would like to review it upstream.If there is no preference, we will keep S1c downstream and ship it in the fork's SDK packages. Please let us know.
Note
This comment was drafted with AI assistance (agent tooling) under the author's direction.
docs: S1c branch cut and reviewer question posted
springmin commentedon Oct 23, 2026
Progress update — native fixes reviewed, CI leg prepared
Merged
qsortworkaround for OpenHarmony (2026-10-22).Open and close to landing
pal_process.c) and @dotnet/ncl (pal_interfaceaddresses.c); both were pinged.s_barrierCopycommit check: approved by @janvorli, CI green, waiting for merge.runtime-community.ymland runs the upstreamsetup-ohos-assets.sh. It waits for native: OpenHarmony native library fixes #136194 to land, then needs aruntime-communityrun (the PR author cannot queue it).Validation
clr.runtime+libs.nativeonupstream/main + feature/openharmony + #136206; build and verifier pass (run 39878384475).feature/openharmonyis synced toupstream/main(a99fb4b2a1b); the merge had a small conflict surface (11 files).rc=0,IsOSPlatform(Linux/OpenHarmony)=true); the MSBuildIsUnixLikechange (Perf: NonGeneric.HashTable default constructor 4x slower on Linux #15342) carries that evidence.SDK follow-ups
Microsoft.NETCore.Platforms, so the SDK should not fork it; SDK-side changes are limited to the RID metadata that does not come from the runtime graph, after the corresponding packs are published.dotnet selfsigncommand for the force path; docs are in Add NETSDK1247-NETSDK1250 docs for OpenHarmony code signing docs#56529.Next: the two area sign-offs for #136194, then a
runtime-communityrun for #136206.Note
This comment was drafted with AI assistance (agent tooling) under the author's direction.
realybin commentedon Oct 26, 2026
@springmin I’m very interested in the work you’re doing. Would you be open to connecting further? You can find my email address on my profile. I was also previously a member of OpenHarmony-NET, where I helped maintain some of the toolchain.