Hasty Briefsbeta

Bilingual

Writing Node.js Addons with .NET Native AOT

9 hours ago
  • #Node.js
  • #C#
  • #Native AOT
  • C# Dev Kit team uses Native AOT with .NET SDK to build Node.js addons, replacing C++ and node-gyp to simplify developer setup and CI pipelines.
  • Native AOT produces shared libraries compatible with N-API, allowing C# code to be called directly from JavaScript in VS Code extensions.
  • Key implementation steps include using [UnmanagedCallersOnly] for entry points, P/Invoke with N-API, and efficient string marshalling using Span<T> and ArrayPool.
  • Benefits include reduced tooling complexity, comparable performance to C++, and potential for in-process .NET workloads in Node.js.