{
  "id": 21279084,
  "title": "Show HN: Zero C# – C# without a runtime or GC",
  "url": "https://urgent.news/2026/11/21/show-hn-zero-c-c-without-a-runtime-or-gc",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-21T15:39:09.000Z",
  "source": {
    "name": "Hacker News Best",
    "slug": "hacker-news-best",
    "url": "https://onurgumus.github.io/zero-csharp/index.html"
  },
  "original_language": "en",
  "account": "In a groundbreaking development, a fork of bflat enables the compilation of C# code into standalone native programs, eliminating the need for a .NET runtime or garbage collector. This innovative approach maintains C#'s familiar syntax, type checking, and generics, while providing memory management through arenas that can be freed all at once. The same source code can run across multiple platforms, including Linux, macOS, Windows, WebAssembly, and DOS on a 386 processor. Notably, the compiler retains all the stringent memory safety checks found in the .NET framework.\n\nThe zero C# implementation offers several advantages over traditional C# programs. For instance, it doesn't require any runtime or additional libraries to be installed, as it uses the native C library on macOS, a container on the same platform, or the system C library on Windows. It can even be compiled directly on a Mac using the Mac's own clang compiler. Furthermore, the program can be executed under the WebAssembly system interface (WASI) using the NativeAOT-LLVM tool, allowing it to run within the wasmtime runtime.\n\nMemory management is handled differently in this native C# implementation. Instead of using a garbage collector, the system employs arenas for memory allocation, and all memory is released at once when a lifetime ends. The I/O operations are streamlined, with input and output handled directly into output and input buffers, respectively. Strings that are expected to persist are stored in the arena, and custom collections like List and Dictionary, along with their reference and string key variants, are also implemented as handles to the arena.\n\nAdopting this zero C# approach involves a few adjustments, as outlined in the provided documentation. Each platform-specific guide explains the changes required and offers solutions to potential challenges. The memory safety rules have been updated to ensure that pointers are always safe to create, and reading through a pointer is explicitly marked and explained. To help newcomers, the resource includes four pages that guide users from a complete beginner to an interactive program, all using the same compilation process supported by FreeDOS and various emulators. For those seeking specific information, the task guides answer targeted questions, while the reference section lists every type available in the library.",
  "summary": "Article URL: https://onurgumus.github.io/zero-csharp/index.html Comments URL: https://news.ycombinator.com/item?id=50590279 Points: 172 # Comments: 120",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}