Renaming is the cheapest obfuscation win: Billing.InvoiceService.Charge becomes a.b.c, and a decompiler no longer hands a reader your architecture. But a, b, c are still readable — an analyst skims them, renames them back mentally, and moves on. There is a stranger option that costs nothing extra at runtime: name the method something that is a perfectly valid entry in .NET metadata but that no C# compiler would ever accept and no text editor can render straight. A right-to-left override. A zero-width space. A Cyrillic letter that is pixel-identical to a Latin one. The assembly runs exactly as before; the decompiled output does not.
The rule C# enforces is not the rule the CLR enforces
C# has a precise notion of an identifier, inherited from the Unicode identifier annex: it must start with a letter or _, continue with letters, decimal digits, connecting or combining marks, and a narrow set of formatting characters, and it may not be a control character or a punctuation glyph. The compiler rejects anything else before a single byte of IL is emitted.
The CLI type system has almost none of that. ECMA-335 stores every type, method, and field name in the #Strings heap — a blob of UTF-8 strings, each terminated by a single NUL byte (0x00). A TypeDef, MethodDef, or FieldDef row does not store the name inline; it stores a 4-byte offset into that heap. The only character a name genuinely cannot contain is U+0000, because that byte is the terminator. Everything else — control characters, bidirectional overrides, zero-width formatting codes, private-use scalars, homoglyphs from other scripts — is a legal sequence of name bytes.
That gap is the whole technique. C#'s identifier rule is a language policy enforced by one front end. The metadata rule is what the runtime actually honours, and it is far more permissive.
What the name looks like in IL
Take Charge and prepend U+202E, the right-to-left override. In UTF-8 that scalar is three bytes, E2 80 AE, so the heap entry becomes E2 80 AE 43 68 61 72 67 65 00 — the override, then Charge, then the terminator. ILDasm has to render that as a quoted identifier, and the only portable way to write a non-ASCII name back for ILAsm is to escape each byte in octal inside single quotes:
.method public hidebysig instance valuetype [System.Runtime]System.Decimal '\342\200\256Charge'(class MyApp.Customer c) cil managed { // method body unchanged } \342\200\256 is exactly E2 80 AE written as three octal escapes — one per UTF-8 byte. ILAsm round-trips this to the same ten bytes in the #Strings heap, so the assembly you reassemble is byte-identical in that name. The call site is no different from any other call; it never mentions the text:
.method public hidebysig instance void Post() cil managed { ldarg.0 ldarg.1 call instance valuetype [System.Runtime]System.Decimal MyApp.Billing.InvoiceService::'\342\200\256Charge'(class MyApp.Customer) // the call is resolved by the MethodDef token, not by the name text pop ret } Three byte sequences make good building blocks because each attacks a different reader:
- A bidirectional override (
U+202ERTL, orU+2066–U+2069isolates) reorders the glyphs after it. A member named egrahCdisplays asChargewhile the metadata — and anything that resolves by bytes — sees the real order. Two members that look identical on screen are distinct keys to the runtime. - A zero-width character (
U+200Bzero-width spaceE2 80 8B, orU+200Djoiner) is invisible.ChargeandChargeare two different metadata names that are indistinguishable to a human and to naive text search. - A homoglyph — Cyrillic
С(U+0421, UTF-8D0 A1) is pixel-identical to LatinC.Сharge(Cyrillic lead) andCharge(Latin) coexist, and a reader renaming one by hand fixes the wrong one.
None of these is exotic to the file format. They are ordinary UTF-8 strings that happen to be hostile to the humans and tools downstream of the loader.
Why the runtime does not care
When Post calls Charge, the C# compiler already resolved the target at compile time and emitted a call against a MethodDef/MemberRef token — a 4-byte value whose low 3 bytes are a row index (RID) into a metadata table. At run time the JIT follows that token straight to the method's row and its RVA. The name string is not consulted on the hot path at all; it exists for reflection, for Type.GetMethod("…") binding by name, and for the stack-trace formatter. Rename the heap entry to a right-to-left override and every token still points at the same row, so the program's behaviour is unchanged to the byte.
A decompiler has the opposite job. It must take the MethodDef row, read the name out of #Strings, and print it as C#. There is no C# spelling for a leading U+202E, so ILSpy or dnSpy either emit the escape (which does not recompile) or render the raw codepoint — at which point your editor applies the override and the whole line reflows right-to-left, parentheses and all. de4dot's name-recovery heuristics assume names are drawn from a sane alphabet; a heap full of zero-width joiners and private-use scalars gives its renamer nothing to grip, and its output is a wall of lookalike symbols that cannot be told apart by eye or by copy-paste.
Turning it on in Nebula.NET
In Nebula this is a naming scheme for the renamer, not a separate pass. The default scheme emits short ASCII names; the Pro tier adds a Unicode scheme that draws replacement names from the control, bidirectional, zero-width, and homoglyph ranges described above:
{ "preservePublicApi": true, "rename": { "enabled": true, "nameScheme": "unicode", "unicode": { "bidiOverrides": true, "zeroWidth": true, "homoglyphs": true } }, "metadataHardening": true } preservePublicApi still applies: Nebula never renames members that are part of your published surface, because a caller compiling against your DLL must be able to write the name in C#. The Unicode scheme is for the internal types and members that nobody outside the assembly is meant to name — which is where renaming does its work anyway. Run it the usual way:
nebula --config nebula.config.json --input publish/MyApp.dll --output publish/obf Crucially, every one of these renames is still recorded in the build's symbol map — original fully-qualified name, the (unprintable) obfuscated name, and the output token — so your own diagnostics survive. When an obfuscated crash comes back from the field, you decode it on your side exactly as with any rename:
nebula deobfuscate --map MyApp-3.1.0.symbols.json --input crash.txt The map is keyed by token, so the fact that the obfuscated frame contains an invisible or reversed name is irrelevant to the lookup. The rename map is the one thing you keep and never ship — it is the exact inverse of the obfuscation, including these names. For the full round trip from an obfuscated trace back to real symbols, see the companion post on reading obfuscated stack traces.
Caveats — where it hurts and where it fails
This is a readability barrier, not encryption. An analyst working at the token level — dumping the MethodDef table, numbering rows, ignoring names entirely — is unaffected; tokens are what they would key on anyway. Treat the Unicode scheme as one layer over control-flow and string protection, never as a substitute for them.
It also has real costs you own. Some third-party tooling, logging that formats type names, and reflection that binds GetType("Namespace.Name") by string can choke on names they cannot represent or round-trip — so anything you reflect over by name, or serialize by type name, must stay on the keep-list. Interop that crosses into native code expecting ANSI names, and a few older debuggers, mis-handle non-ASCII identifiers. And because the names are genuinely confusable, you must never debug the obfuscated build by eye; always go through the map. Nebula's default keep-list covers public API, serialization-attributed types, and entry points, but anything you resolve dynamically is yours to exclude.
Takeaway
C#'s idea of a legal identifier is a front-end courtesy, not a law of the runtime. Metadata names are UTF-8 strings in the #Strings heap, the loader binds by token, and the only forbidden byte is the NUL terminator — so a method can be named with a right-to-left override, a zero-width joiner, or a homoglyph and still load, resolve, and run identically, while the decompiled result is unreadable or will not recompile. Nebula.NET Pro offers this as a renamer naming scheme, keeps your public surface untouched, and records every rename in the symbol map so your stack traces stay decodable on your side. Used as one layer among several, it turns the cheapest obfuscation step into one that also defeats the text-based tooling an analyst reaches for first.