You rename-obfuscate a desktop app, ship it, and a crash report comes back:
System.ArgumentOutOfRangeException: No tax rate configured (Parameter 'region')
at A.n.a(String) in C:\build\Acme.Billing\src\InvoiceService.cs:line 16
at A.n.c(Invoice) in C:\build\Acme.Billing\src\InvoiceService.cs:line 6
The names are gone — InvoiceService.RateFor is now A.n.a. But look at the tail of each frame. The file path is still there, and it reads InvoiceService.cs — the exact type name you renamed n to hide. The line numbers are there too. Renaming scrubbed the symbol table; it never touched the debug information, and the debug information handed the attacker back the file name, the directory you build in, and the precise line of every frame.
Where the line numbers actually come from
Here is the fact that trips people up: :line 16 is not in the DLL. A .NET assembly's metadata stores type and method names (in the #Strings heap) but no source lines, no columns, no file paths. All of that lives in a separate artifact — the Portable PDB — and a stack trace only shows it when that PDB is present and loaded.
A Portable PDB is itself a metadata file, with its own tables. Two matter here:
-
Document— one row per source file: the file path, a content hash, the hash algorithm, and a language GUID. -
MethodDebugInformation— one row per method, in lock-step with theMethodDeftable in the DLL (same row IDs). It has two columns: aDocumentreference (used when every point in the method is in one file; zero otherwise) and aSequencePointsblob.
The SequencePoints blob is the heart of it. It is a delta-encoded list that maps IL offsets to source positions. Each record carries an IL-offset delta and then the start line, start column, end line and end column — the first record absolute, every record after it encoded as a delta from the previous one, which is what keeps the blob small. Decoded for RateFor, it reads like this:
IL offset (startLine:col – endLine:col) document
0x0000 → 16:9 – 16:16 InvoiceService.cs
0x0007 → 16:16 – 16:65
0x0012 → 0xFEEFEE (hidden)
0x001a → 18:9 – 18:10
One row per method, pointed at by MethodDebugInformation, mapping the IL the JIT actually ran back to the C# you actually wrote:
namespace Acme.Billing;
public sealed class InvoiceService
{
public decimal ComputeTotal(Invoice invoice) =>
ApplyTax(invoice.Subtotal, invoice.Region); // line 6
private decimal RateFor(string region) => region switch
{
"EU" => 0.20m,
_ => throw new ArgumentOutOfRangeException(
nameof(region), region, "No tax rate configured"), // line 16
};
}
Note the third record above, 0xFEEFEE. That is the hidden sequence point. In a classic Windows PDB a hidden point is written with the magic line number 0xFEEFEE (16,707,566), meaning "this IL range has no source correspondence" — compiler-generated code, a branch target the compiler inserted, the closing brace of a method. In a Portable PDB the same state is encoded as a record whose line and column deltas are all zero. Either representation tells the debugger: step over this range, highlight nothing. It is why single-stepping sometimes jumps past code that has no line to land on.
How the trace gets its line
When RateFor throws, the CLR records one frame per managed method: a method handle (a MethodDef token) plus the IL offset where control was. That is all a frame is. When Exception.StackTrace.ToString() runs, it resolves each handle two ways. The name — A.n.a(String) — comes from the DLL's #Strings heap. The in … .cs:line 16 comes from the PDB: the formatter takes the frame's IL offset, finds the sequence point that covers it, and reads that point's start line plus its document's file path.
So renaming and line numbers are two independent leaks from two independent files. Rename obfuscation rewrites #Strings, so the name resolves to A.n.a. It does nothing to the PDB, so the sequence point still maps IL offset 0x001a to line 16 of InvoiceService.cs. The attacker reads a renamed symbol and, in the same frame, an un-renamed file path that re-announces the very class name you paid to hide.
What Nebula removes, and how
The fix is to break the IL-offset-to-source map. If the sequence points are gone, the formatter has nothing to turn offset 0x001a into, so the frame renders as at A.n.a(String) with no suffix at all — no path, no line.
There are two ways the debug info ships, and Nebula handles both:
-
Separate
.pdb(<DebugType>portable</DebugType>) — a standalone file next to the DLL. Not deploying it is the first line of defence, but "we just won't copy it" is fragile: a symbol file that exists anywhere is a file that can be copied to the wrong place. Nebula strips the sequence-point and document tables from the output so the shipped assembly carries no map even if a stray.pdbturns up. -
Embedded (
<DebugType>embedded</DebugType>) — the Portable PDB is packed inside the DLL, referenced from the PE debug directory. Here "don't copy the.pdb" is meaningless; the debug info is in the assembly. Nebula removes that embedded blob from the protected output.
In nebula.config.json this is a stage of its own, run as part of protection:
{
"schemaVersion": 1,
"inputs": [ "bin/Release/net8.0/Acme.Billing.dll" ],
"outputDirectory": "protected",
"rename": { "enabled": true },
"debug": {
"stripSequencePoints": true,
"removeEmbeddedPdb": true,
"emitRetraceMap": "protected/Acme.Billing.retrace.json"
}
}
nebula protect --config nebula.config.json --out protected
The one setting that carries the whole trade-off is emitRetraceMap. Stripping the sequence points is deleting information — and it is your information. If you discard it outright, the A.n.a(String) frame is as opaque to you as to the attacker. So before Nebula strips the blob, it records what it is about to delete: for every method, the IL-offset-to-line mapping and the document, written to a private map that never leaves your build machine. That is the same discipline as the renaming map, applied to the other leak. The renaming map inverts A.n.a back to InvoiceService.RateFor; the sequence-point map inverts the now-absent line back to InvoiceService.cs:16. Keep both archived next to the build, and a line-less obfuscated frame is a nebula retrace away from a full, original frame — a lookup covered in detail in Reversing an obfuscated stack trace for the name half of the same map.
When it breaks, and what it does not cover
Honesty first: stripping sequence points makes your own triage harder, which is exactly why the retrace map is not optional. If you strip without emitting the map, you have thrown away the line numbers for good — do not do that on a Release you will have to support.
A few more limits worth stating plainly:
-
Line info you baked in yourself survives.
[CallerLineNumber]captures the call site's line at compile time and bakes it into the IL as a constant. Many logging helpers use it. Stripping the PDB does nothing to those — the line number is already in the assembly, as a literal. Audit your logging if the goal is that no original line leaks at all. - IL still describes the logic. Removing debug info removes a convenience, not the program. A determined analyst reconstructs control flow from the IL directly; line numbers just made it faster. This pass pairs with control-flow obfuscation and string encryption, which attack the logic itself.
-
Names are a different leak. Dropping the PDB removes lines and paths, never names — those are in
#Strings, and only rename obfuscation (and heap compaction to delete the orphaned originals) removes them. The two passes are independent; ship both if you want a frame that reveals neither. -
Legacy PDBs. A full/pdbonly Windows PDB uses the literal
0xFEEFEEhidden marker and a different on-disk shape than the Portable format, but the leak and the fix are identical: strip the sequence points from what you ship.
Takeaway
The :line 16 and the InvoiceService.cs in a production crash do not come from your DLL — they come from the Portable PDB's MethodDebugInformation table and its delta-encoded sequence-point blob, which maps every IL offset to a source line (and marks compiler-generated ranges hidden with 0xFEEFEE). Rename obfuscation never touches that map, so a renamed assembly keeps announcing the file and line of every frame. Strip the sequence points — from the separate .pdb and the embedded blob alike — and the frame collapses to at A.n.a(String). Emit the retrace map while you do it, archive it privately, and nebula retrace gives you the original frame back whenever a crash report needs it. See Nebula.NET for the full pipeline, or the retrace guide for the Pro workflow.
Top comments (0)