Table of Contents

OpenHarmony.NET

Introduction

🤔What is OpenHarmony.NET?

OpenHarmony.NET is a solution designed specifically for OpenHarmony (including HarmonyOS Next), aimed at supporting .NET applications on the Harmony operating system. With OpenHarmony.NET, developers can use familiar Avalonia or Blazor Hybrid technologies to develop Harmony applications, and even use C# instead of C++ for native library development. This provides .NET developers with a new platform, enabling them to easily introduce the .NET technology stack into the Harmony ecosystem.

😲Runtime Support

· Adaptation Status

OpenHarmony.NET has been successfully adapted to .NET 9, providing developers with a stable and efficient runtime environment.

· Runtime Limitations

  1. Only NativeAOT Available: Due to Harmony system restrictions on runtime-generated assembly code (see Harmony System Change Notes), JIT (Just-In-Time) technology cannot be used. Therefore, OpenHarmony.NET adopts NativeAOT (Native Ahead-Of-Time) compilation. This method generates native machine code directly during compilation, ensuring efficient application execution on the Harmony system.

  2. Cannot Use Marshal.GetDelegateForFunctionPointer Related Functions: For the same reason as above, direct use of function pointers is recommended.

🥰Framework Adaptation

Supported Frameworks

Currently, OpenHarmony.NET has successfully adapted the following two frameworks:

  1. Avalonia: A cross-platform UI framework that supports desktop application development using XAML and C#. For details, please refer to the Avalonia Documentation.
  2. Blazor Hybrid: A hybrid development framework based on Blazor, allowing cross-platform application development using C# and Razor syntax. For details, please refer to the Blazor Hybrid Documentation.

More Framework Adaptations

We welcome more .NET frameworks to join the OpenHarmony.NET ecosystem. If you are interested in adapting other frameworks, we are willing to share valuable experience accumulated during the adaptation of Avalonia and Blazor Hybrid to help you get started quickly.