Table of Contents

Class SourcePathAnonymizer

Namespace
RDCore.SDK.ConsoleIO
Assembly
RDCore.SDK.dll

Removes an absolute source-file path from exception / stack-trace text before that text can be packaged into a DTO and sent to another process.

public static class SourcePathAnonymizer
Inheritance
SourcePathAnonymizer
Inherited Members

Remarks

A build that ships PDBs (the dev platform is Debug; a Release publish still emits portable PDBs with absolute document paths) produces stack frames like … in /home/somebody/src/RDCore/RDCore.Parsing/…/Foo.cs:line 12, disclosing the build machine's directory layout and user name. This rewrites those frames at the DTO funnel; the unredacted text is still written to the process log. It is a defensive net — the source fix is PathMap / ContinuousIntegrationBuild at build time, so Roslyn never writes an absolute document path.

A pure function with no state, DI, or configuration.

Methods

Scrub(string, SourcePathScrubMode)

Rewrites every source path in text per mode. Text with no recognizable stack frame is returned unchanged.

public static string Scrub(string text, SourcePathScrubMode mode = SourcePathScrubMode.RepoRelative)

Parameters

text string

Exception or stack-trace text, typically ToString().

mode SourcePathScrubMode

How to rewrite each path. Defaults to RepoRelative.

Returns

string