← Sat, Nov 21 digest

Show HN: Zero C# – C# without a runtime or GC

read article ↗ hn thread ↗

Zero C# is a bflat fork compiling C# code to tiny native binaries without a .NET runtime or garbage collector, using arena allocation instead.

summary is enough The concept is a neat technical novelty, but the severe limitations—no standard library, no reflection, and manual arena allocation—make it impractical for real-world projects.

summary

Zero C# removes the .NET runtime and garbage collector, targeting tiny native binaries across platforms from modern OSes to 386 DOS. Memory management relies on manual arenas, while exceptions, reflection, and standard .NET libraries are stripped out. Commenters point out that modern C# already offers low-level control features like Span and NativeAOT, making Zero C# more of an esoteric exercise than a practical alternative to Rust, C, or standard .NET.

key points

  1. Compiles C# directly to native binaries as small as 11KB on Windows and 40KB on Linux without any .NET runtime.
  2. Replaces the garbage collector with manual arena allocation and omits features like exceptions, async, and reflection.
  3. Targets unconventional environments, including WebAssembly and 386 DOS via the HX DOS extender.

who should read it

Developers interested in low-level systems programming, bare-metal development, and experimental language toolchains.

discussion skeptical

consensus

Commenters are largely skeptical of its practical utility, arguing that modern .NET already provides powerful low-level tools like NativeAOT and that stripping the runtime and reflection leaves a restricted syntax rather than a usable ecosystem.

pushback

A few see value for niche use cases like retro computing targets or extreme binary size reduction where standard .NET overhead is unacceptable.

best comment by real_faxenoff ↗

I'm developing a small .NET utility called montab (https://github.com/faxenoff/montab - taskbar with permanent previews for Windows) and have been trying to minimize its size and CPU/GPU usage as much as possible. The result is a 0.88 Mb binary with near-zero system load.

It would seem that Zero C# is the ideal solution for me. But here’s what I’ve actually found out: I’d have to rewrite absolutely everything, and the lack of a garbage collector when constantly working with a bunch of WinAPI calls is a problem with no solution.

I’ve come to realize that this might only be suitable for new …

A developer who tried using it for a minimal Windows utility discovered that the lack of a garbage collector and standard library makes rewriting everything for WinAPI integration impractical.

Generated by an LLM from the article and thread. Check the sources before relying on it.