[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dotnet-generate-testability-wrappers":3,"mdc-rqlnlo-key":37,"related-org-dotnet-generate-testability-wrappers":2040,"related-repo-dotnet-generate-testability-wrappers":2202},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":32,"sourceUrl":35,"mdContent":36},"generate-testability-wrappers","generate testability wrappers for C# dependencies","Generate wrapper interfaces and DI registration for hard-to-test static dependencies in C#, when the abstraction does NOT exist yet. Produces IFileSystem, IEnvironmentProvider, IConsole, IProcessRunner wrappers, or guides first-time adoption of TimeProvider and IHttpClientFactory. With no DI container, produces the ambient context seam instead. USE FOR: generate wrapper for static, create IFileSystem wrapper, wrap DateTime.Now, make a static or a class testable, create abstraction for File.*, generate DI registration, adopt TimeProvider when it is not registered yet, IHttpClientFactory setup, testability wrapper, how to make statics injectable, adopt System.IO.Abstractions, make code testable without adding a DI framework. DO NOT USE FOR: detecting statics (use detect-static-dependencies), migrating call sites or replacing existing DateTime.*\u002FFile.* usages once the wrapper is created or already registered in DI (use migrate-static-to-wrapper), general interface design.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"dotnet",".NET (Microsoft)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdotnet.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"C#","csharp","tag",{"name":17,"slug":18,"type":15},"Architecture","architecture",{"name":20,"slug":21,"type":15},".NET","net",{"name":23,"slug":24,"type":15},"Testing","testing",4576,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills","2026-08-01T05:42:18.152025","MIT",332,[31],"agent-skills",{"repoUrl":26,"stars":25,"forks":29,"topics":33,"description":34},[31],"Repository for skills to assist AI coding agents with .NET and C#","https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills\u002Ftree\u002FHEAD\u002Fplugins\u002Fdotnet-test\u002Fskills\u002Fgenerate-testability-wrappers","---\nname: generate-testability-wrappers\ndescription: >\n  Generate wrapper interfaces and DI registration for hard-to-test static dependencies in C#,\n  when the abstraction does NOT exist yet. Produces IFileSystem, IEnvironmentProvider, IConsole,\n  IProcessRunner wrappers, or guides first-time adoption of TimeProvider and IHttpClientFactory.\n  With no DI container, produces the ambient context seam instead.\n  USE FOR: generate wrapper for static, create IFileSystem wrapper, wrap DateTime.Now,\n  make a static or a class testable, create abstraction for File.*, generate DI registration,\n  adopt TimeProvider when it is not registered yet, IHttpClientFactory setup, testability\n  wrapper, how to make statics injectable, adopt System.IO.Abstractions, make code testable\n  without adding a DI framework.\n  DO NOT USE FOR: detecting statics (use detect-static-dependencies), migrating\n  call sites or replacing existing DateTime.*\u002FFile.* usages once the wrapper is created\n  or already registered in DI (use migrate-static-to-wrapper), general interface design.\nlicense: MIT\n---\n\n# Generate Testability Wrappers\n\nGenerate wrapper interfaces, default implementations, and DI service registration code for untestable static dependencies. For statics that already have .NET built-in abstractions (`TimeProvider`, `IHttpClientFactory`), guide adoption of the built-in. For statics without built-in alternatives, generate custom minimal wrappers.\n\n## When to Use\n\n- After running `detect-static-dependencies` and identifying which statics to wrap\n- When the user asks to make a class testable by replacing statics with injected abstractions\n- When adopting `TimeProvider` (.NET 8+) or `System.IO.Abstractions`\n- When creating a custom wrapper for `Environment.*`, `Console.*`, or `Process.*`\n- When there is no DI container and the seam has to be ambient rather than injected\n\n## When Not to Use\n\n- The user wants to find statics first (use `detect-static-dependencies`)\n- The user wants to bulk-replace call sites (use `migrate-static-to-wrapper`)\n- The static is already behind an interface\n\n> A project with **no DI container**, or a user who does not want to add one, is **not** a reason to skip this skill —\n> that is exactly what the ambient context seam in Step 5 is for. Choose the seam over constructor injection in that\n> case; do not decline the request and do not propose registering anything in a service collection.\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Static category | Yes | Which category: `time`, `filesystem`, `environment`, `network`, `console`, `process` |\n| Target framework | Yes | The `TargetFramework` from `.csproj` (affects which built-in abstractions exist) |\n| DI container | No | Which DI framework: `microsoft` (default), `autofac`, `none` (ambient context) |\n| Namespace | No | Target namespace for generated wrapper code |\n\n## Workflow\n\n### Step 1: Determine the abstraction strategy\n\nBased on the category and target framework:\n\n| Category | .NET 8+ | .NET 6-7 | .NET Framework |\n|----------|---------|----------|----------------|\n| Time | `TimeProvider` (built-in) | `TimeProvider` via `Microsoft.Bcl.TimeProvider` NuGet | Custom `ISystemClock` |\n| File system | `System.IO.Abstractions` (NuGet) | Same | Same |\n| HTTP | `IHttpClientFactory` (built-in) | Same | Same |\n| Environment | Custom `IEnvironmentProvider` | Same | Same |\n| Console | Custom `IConsole` | Same | Same |\n| Process | Custom `IProcessRunner` | Same | Same |\n\nThe table picks *which abstraction*. How it reaches the code under test is a separate axis: constructor\ninjection when a DI container exists, and the **ambient context seam of Step 5** when one does not. Decide that\naxis first — check for a host builder, `IServiceCollection`, or an existing container registration — because a\nstatic class cannot take a constructor and a project without a container has nowhere to register anything. In\nthat case skip Steps 2–4 and go to Step 5; the abstraction chosen above still applies, it is just reached through\nthe ambient seam.\n\n### Step 2: Generate built-in abstraction adoption (Time, HTTP)\n\n#### TimeProvider (.NET 8+)\n\nNo wrapper code needed — guide the user:\n\n1. Register in DI:\n```csharp\nbuilder.Services.AddSingleton(TimeProvider.System);\n```\n\n2. Inject into classes:\n```csharp\npublic class OrderProcessor(TimeProvider timeProvider)\n{\n    public bool IsExpired(Order order)\n        => timeProvider.GetUtcNow() > order.ExpiresAt;\n}\n```\n\n3. Test with `FakeTimeProvider`:\n```csharp\n\u002F\u002F Requires Microsoft.Extensions.TimeProvider.Testing NuGet\nvar fakeTime = new FakeTimeProvider(new DateTimeOffset(2026, 1, 15, 0, 0, 0, TimeSpan.Zero));\nvar processor = new OrderProcessor(fakeTime);\nfakeTime.Advance(TimeSpan.FromDays(1));\nAssert.True(processor.IsExpired(order));\n```\n\n#### TimeProvider (pre-.NET 8)\n\nGuide: install `Microsoft.Bcl.TimeProvider` NuGet. Same API as above.\n\n#### IHttpClientFactory\n\nNo wrapper code needed — register typed clients via `builder.Services.AddHttpClient\u003CMyService>()` and inject `HttpClient` directly into the class constructor.\n\n### Step 3: Generate custom wrappers (Environment, Console, Process)\n\nFor categories without built-in abstractions, follow this template:\n\n#### Interface — define the minimal surface\n\nOnly include methods that were actually detected in the codebase. Do NOT generate a wrapper for every possible member — wrap only what is used.\n\n```csharp\nnamespace \u003CNamespace>;\n\n\u002F\u002F\u002F \u003Csummary>\n\u002F\u002F\u002F Abstraction over \u003Cstatic class> for testability. \n\u002F\u002F\u002F \u003C\u002Fsummary>\npublic interface I\u003CWrapperName>\n{\n    \u002F\u002F One method per detected static call\n    \u003Creturn type> \u003CMethodName>(\u003Cparameters>);\n}\n```\n\n#### Default implementation — delegate to the real static\n\n```csharp\nnamespace \u003CNamespace>;\n\n\u002F\u002F\u002F \u003Csummary>\n\u002F\u002F\u002F Default implementation that delegates to \u003Cstatic class>.\n\u002F\u002F\u002F \u003C\u002Fsummary>\npublic sealed class \u003CWrapperName> : I\u003CWrapperName>\n{\n    public \u003Creturn type> \u003CMethodName>(\u003Cparameters>)\n        => \u003CStaticClass>.\u003CMethod>(\u003Carguments>);\n}\n```\n\n#### DI registration\n\n```csharp\n\u002F\u002F In Program.cs or Startup.cs:\nbuilder.Services.AddSingleton\u003CI\u003CWrapperName>, \u003CWrapperName>>();\n```\n\n### Step 4: Generate file system wrapper adoption\n\nPrefer the established `System.IO.Abstractions` NuGet package over custom wrappers:\n\n1. Install the package:\n```\ndotnet add package System.IO.Abstractions\n```\n\n2. Register in DI:\n```csharp\nbuilder.Services.AddSingleton\u003CIFileSystem, FileSystem>();\n```\n\n3. Inject `IFileSystem` into classes:\n```csharp\npublic class ConfigLoader(IFileSystem fileSystem)\n{\n    public string LoadConfig(string path)\n        => fileSystem.File.ReadAllText(path);\n}\n```\n\n4. Test with `MockFileSystem`:\n```\ndotnet add \u003CTestProject> package System.IO.Abstractions.TestingHelpers\n```\n```csharp\nvar mockFs = new MockFileSystem(new Dictionary\u003Cstring, MockFileData>\n{\n    { \"\u002Fconfig.json\", new MockFileData(\"{\\\"key\\\": \\\"value\\\"}\") }\n});\nvar loader = new ConfigLoader(mockFs);\nAssert.Equal(\"{\\\"key\\\": \\\"value\\\"}\", loader.LoadConfig(\"\u002Fconfig.json\"));\n```\n\n### Step 5: Generate ambient context alternative (when DI is not available)\n\nIf the codebase does not use DI (e.g., old console app, library code), offer the ambient context pattern:\n\n```csharp\npublic static class Clock\n{\n    private static readonly AsyncLocal\u003CFunc\u003CDateTimeOffset>?> s_override = new();\n    public static DateTimeOffset UtcNow\n        => s_override.Value?.Invoke() ?? TimeProvider.System.GetUtcNow();\n\n    public static IDisposable Override(DateTimeOffset fixedTime)\n    {\n        s_override.Value = () => fixedTime;\n        return new Scope();\n    }\n    private sealed class Scope : IDisposable\n    {\n        public void Dispose() => s_override.Value = null;\n    }\n}\n```\n\nKey trade-offs: `AsyncLocal\u003CT>` ensures parallel tests don't interfere; production cost is one null check per call; the `static readonly` field is essentially free.\n\nThree properties this pattern must keep, because each has broken a real migration:\n\n- **Scope the override and make it reversible.** Return an `IDisposable` that restores the previous value, so a test cannot leak a pinned time into the next one. A bare setter, or a manual `try`\u002F`finally` at each call site, puts that burden on every test author.\n- **Use `AsyncLocal\u003CT>`, never `[ThreadStatic]`.** `[ThreadStatic]` does not flow across `await`, so the override silently disappears mid-test.\n- **Preserve the semantics of the member you are replacing.** Substituting `DateTime.UtcNow` with a local-time source changes the `DateTimeKind` every existing caller and stored value depends on — pair `UtcNow` with `GetUtcNow()`, and `Now` with `GetLocalNow()`.\n\nThe same shape works for non-time statics: swap `TimeProvider.System.GetUtcNow()` for the real static call and keep the override slot, the disposable scope, and the original semantics.\n\n### Step 6: Place generated files\n\nGenerate files following the project's existing conventions:\n- If there is an `Abstractions\u002F` or `Interfaces\u002F` folder, place the interface there\n- If there is an `Infrastructure\u002F` or `Services\u002F` folder, place the implementation there\n- Otherwise, create files next to the code that uses the static\n\nAlways generate:\n1. The interface file (or adoption instructions for built-in abstractions)\n2. The default implementation file\n3. The DI registration snippet (as a code comment at the bottom of the implementation, or as separate instructions) — **skip this one entirely on the ambient-seam path**: there is no container to register into, and offering one anyway is the failure mode that made a user ask for the seam in the first place\n\n## Validation\n\n- [ ] Generated interface only wraps statics that were actually detected (not speculative)\n- [ ] Default implementation delegates to the real static with no behavior changes\n- [ ] DI registration uses `AddSingleton` for stateless wrappers, `AddTransient` for stateful ones\n- [ ] NuGet packages are recommended where established libraries exist (System.IO.Abstractions, etc.)\n- [ ] For .NET 8+, `TimeProvider` is recommended over custom `ISystemClock`\n- [ ] Ambient context pattern includes `AsyncLocal\u003CT>`, a scoped `IDisposable` that restores the previous value, and trade-off explanation\n- [ ] On the ambient-seam path, no `IServiceCollection` registration is proposed and the replaced member's semantics (`UtcNow` vs `Now`, and its `DateTimeKind`) are preserved\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| Declining because the project has no DI container | The ambient seam in Step 5 is the answer for that case — offer it instead of asking the user to adopt a container |\n| Wrapping ALL members of a static class | Only wrap methods actually called in the codebase |\n| Custom time wrapper on .NET 8+ | Use built-in `TimeProvider` instead |\n| Custom file system wrapper | Prefer `System.IO.Abstractions` NuGet — battle-tested, complete |\n| Registering scoped when singleton suffices | Stateless wrappers should be `AddSingleton` |\n| Forgetting test helper packages | `Microsoft.Extensions.TimeProvider.Testing` for time, `System.IO.Abstractions.TestingHelpers` for filesystem |\n| Ambient context without `AsyncLocal` | Non-async `[ThreadStatic]` breaks with `async`\u002F`await` — always use `AsyncLocal\u003CT>` |\n",{"data":38,"body":39},{"name":4,"description":6,"license":28},{"type":40,"children":41},"root",[42,50,73,80,152,158,190,214,220,403,409,416,421,630,658,664,671,676,685,705,714,764,780,827,833,845,850,871,877,882,888,893,984,990,1071,1077,1100,1106,1118,1126,1136,1143,1157,1173,1218,1232,1241,1295,1301,1306,1442,1463,1468,1601,1614,1620,1625,1673,1678,1703,1709,1850,1856,2034],{"type":43,"tag":44,"props":45,"children":46},"element","h1",{"id":4},[47],{"type":48,"value":49},"text","Generate Testability Wrappers",{"type":43,"tag":51,"props":52,"children":53},"p",{},[54,56,63,65,71],{"type":48,"value":55},"Generate wrapper interfaces, default implementations, and DI service registration code for untestable static dependencies. For statics that already have .NET built-in abstractions (",{"type":43,"tag":57,"props":58,"children":60},"code",{"className":59},[],[61],{"type":48,"value":62},"TimeProvider",{"type":48,"value":64},", ",{"type":43,"tag":57,"props":66,"children":68},{"className":67},[],[69],{"type":48,"value":70},"IHttpClientFactory",{"type":48,"value":72},"), guide adoption of the built-in. For statics without built-in alternatives, generate custom minimal wrappers.",{"type":43,"tag":74,"props":75,"children":77},"h2",{"id":76},"when-to-use",[78],{"type":48,"value":79},"When to Use",{"type":43,"tag":81,"props":82,"children":83},"ul",{},[84,98,103,121,147],{"type":43,"tag":85,"props":86,"children":87},"li",{},[88,90,96],{"type":48,"value":89},"After running ",{"type":43,"tag":57,"props":91,"children":93},{"className":92},[],[94],{"type":48,"value":95},"detect-static-dependencies",{"type":48,"value":97}," and identifying which statics to wrap",{"type":43,"tag":85,"props":99,"children":100},{},[101],{"type":48,"value":102},"When the user asks to make a class testable by replacing statics with injected abstractions",{"type":43,"tag":85,"props":104,"children":105},{},[106,108,113,115],{"type":48,"value":107},"When adopting ",{"type":43,"tag":57,"props":109,"children":111},{"className":110},[],[112],{"type":48,"value":62},{"type":48,"value":114}," (.NET 8+) or ",{"type":43,"tag":57,"props":116,"children":118},{"className":117},[],[119],{"type":48,"value":120},"System.IO.Abstractions",{"type":43,"tag":85,"props":122,"children":123},{},[124,126,132,133,139,141],{"type":48,"value":125},"When creating a custom wrapper for ",{"type":43,"tag":57,"props":127,"children":129},{"className":128},[],[130],{"type":48,"value":131},"Environment.*",{"type":48,"value":64},{"type":43,"tag":57,"props":134,"children":136},{"className":135},[],[137],{"type":48,"value":138},"Console.*",{"type":48,"value":140},", or ",{"type":43,"tag":57,"props":142,"children":144},{"className":143},[],[145],{"type":48,"value":146},"Process.*",{"type":43,"tag":85,"props":148,"children":149},{},[150],{"type":48,"value":151},"When there is no DI container and the seam has to be ambient rather than injected",{"type":43,"tag":74,"props":153,"children":155},{"id":154},"when-not-to-use",[156],{"type":48,"value":157},"When Not to Use",{"type":43,"tag":81,"props":159,"children":160},{},[161,173,185],{"type":43,"tag":85,"props":162,"children":163},{},[164,166,171],{"type":48,"value":165},"The user wants to find statics first (use ",{"type":43,"tag":57,"props":167,"children":169},{"className":168},[],[170],{"type":48,"value":95},{"type":48,"value":172},")",{"type":43,"tag":85,"props":174,"children":175},{},[176,178,184],{"type":48,"value":177},"The user wants to bulk-replace call sites (use ",{"type":43,"tag":57,"props":179,"children":181},{"className":180},[],[182],{"type":48,"value":183},"migrate-static-to-wrapper",{"type":48,"value":172},{"type":43,"tag":85,"props":186,"children":187},{},[188],{"type":48,"value":189},"The static is already behind an interface",{"type":43,"tag":191,"props":192,"children":193},"blockquote",{},[194],{"type":43,"tag":51,"props":195,"children":196},{},[197,199,205,207,212],{"type":48,"value":198},"A project with ",{"type":43,"tag":200,"props":201,"children":202},"strong",{},[203],{"type":48,"value":204},"no DI container",{"type":48,"value":206},", or a user who does not want to add one, is ",{"type":43,"tag":200,"props":208,"children":209},{},[210],{"type":48,"value":211},"not",{"type":48,"value":213}," a reason to skip this skill —\nthat is exactly what the ambient context seam in Step 5 is for. Choose the seam over constructor injection in that\ncase; do not decline the request and do not propose registering anything in a service collection.",{"type":43,"tag":74,"props":215,"children":217},{"id":216},"inputs",[218],{"type":48,"value":219},"Inputs",{"type":43,"tag":221,"props":222,"children":223},"table",{},[224,248],{"type":43,"tag":225,"props":226,"children":227},"thead",{},[228],{"type":43,"tag":229,"props":230,"children":231},"tr",{},[232,238,243],{"type":43,"tag":233,"props":234,"children":235},"th",{},[236],{"type":48,"value":237},"Input",{"type":43,"tag":233,"props":239,"children":240},{},[241],{"type":48,"value":242},"Required",{"type":43,"tag":233,"props":244,"children":245},{},[246],{"type":48,"value":247},"Description",{"type":43,"tag":249,"props":250,"children":251},"tbody",{},[252,312,345,386],{"type":43,"tag":229,"props":253,"children":254},{},[255,261,266],{"type":43,"tag":256,"props":257,"children":258},"td",{},[259],{"type":48,"value":260},"Static category",{"type":43,"tag":256,"props":262,"children":263},{},[264],{"type":48,"value":265},"Yes",{"type":43,"tag":256,"props":267,"children":268},{},[269,271,277,278,284,285,291,292,298,299,305,306],{"type":48,"value":270},"Which category: ",{"type":43,"tag":57,"props":272,"children":274},{"className":273},[],[275],{"type":48,"value":276},"time",{"type":48,"value":64},{"type":43,"tag":57,"props":279,"children":281},{"className":280},[],[282],{"type":48,"value":283},"filesystem",{"type":48,"value":64},{"type":43,"tag":57,"props":286,"children":288},{"className":287},[],[289],{"type":48,"value":290},"environment",{"type":48,"value":64},{"type":43,"tag":57,"props":293,"children":295},{"className":294},[],[296],{"type":48,"value":297},"network",{"type":48,"value":64},{"type":43,"tag":57,"props":300,"children":302},{"className":301},[],[303],{"type":48,"value":304},"console",{"type":48,"value":64},{"type":43,"tag":57,"props":307,"children":309},{"className":308},[],[310],{"type":48,"value":311},"process",{"type":43,"tag":229,"props":313,"children":314},{},[315,320,324],{"type":43,"tag":256,"props":316,"children":317},{},[318],{"type":48,"value":319},"Target framework",{"type":43,"tag":256,"props":321,"children":322},{},[323],{"type":48,"value":265},{"type":43,"tag":256,"props":325,"children":326},{},[327,329,335,337,343],{"type":48,"value":328},"The ",{"type":43,"tag":57,"props":330,"children":332},{"className":331},[],[333],{"type":48,"value":334},"TargetFramework",{"type":48,"value":336}," from ",{"type":43,"tag":57,"props":338,"children":340},{"className":339},[],[341],{"type":48,"value":342},".csproj",{"type":48,"value":344}," (affects which built-in abstractions exist)",{"type":43,"tag":229,"props":346,"children":347},{},[348,353,358],{"type":43,"tag":256,"props":349,"children":350},{},[351],{"type":48,"value":352},"DI container",{"type":43,"tag":256,"props":354,"children":355},{},[356],{"type":48,"value":357},"No",{"type":43,"tag":256,"props":359,"children":360},{},[361,363,369,371,377,378,384],{"type":48,"value":362},"Which DI framework: ",{"type":43,"tag":57,"props":364,"children":366},{"className":365},[],[367],{"type":48,"value":368},"microsoft",{"type":48,"value":370}," (default), ",{"type":43,"tag":57,"props":372,"children":374},{"className":373},[],[375],{"type":48,"value":376},"autofac",{"type":48,"value":64},{"type":43,"tag":57,"props":379,"children":381},{"className":380},[],[382],{"type":48,"value":383},"none",{"type":48,"value":385}," (ambient context)",{"type":43,"tag":229,"props":387,"children":388},{},[389,394,398],{"type":43,"tag":256,"props":390,"children":391},{},[392],{"type":48,"value":393},"Namespace",{"type":43,"tag":256,"props":395,"children":396},{},[397],{"type":48,"value":357},{"type":43,"tag":256,"props":399,"children":400},{},[401],{"type":48,"value":402},"Target namespace for generated wrapper code",{"type":43,"tag":74,"props":404,"children":406},{"id":405},"workflow",[407],{"type":48,"value":408},"Workflow",{"type":43,"tag":410,"props":411,"children":413},"h3",{"id":412},"step-1-determine-the-abstraction-strategy",[414],{"type":48,"value":415},"Step 1: Determine the abstraction strategy",{"type":43,"tag":51,"props":417,"children":418},{},[419],{"type":48,"value":420},"Based on the category and target framework:",{"type":43,"tag":221,"props":422,"children":423},{},[424,450],{"type":43,"tag":225,"props":425,"children":426},{},[427],{"type":43,"tag":229,"props":428,"children":429},{},[430,435,440,445],{"type":43,"tag":233,"props":431,"children":432},{},[433],{"type":48,"value":434},"Category",{"type":43,"tag":233,"props":436,"children":437},{},[438],{"type":48,"value":439},".NET 8+",{"type":43,"tag":233,"props":441,"children":442},{},[443],{"type":48,"value":444},".NET 6-7",{"type":43,"tag":233,"props":446,"children":447},{},[448],{"type":48,"value":449},".NET Framework",{"type":43,"tag":249,"props":451,"children":452},{},[453,500,527,552,578,604],{"type":43,"tag":229,"props":454,"children":455},{},[456,461,471,489],{"type":43,"tag":256,"props":457,"children":458},{},[459],{"type":48,"value":460},"Time",{"type":43,"tag":256,"props":462,"children":463},{},[464,469],{"type":43,"tag":57,"props":465,"children":467},{"className":466},[],[468],{"type":48,"value":62},{"type":48,"value":470}," (built-in)",{"type":43,"tag":256,"props":472,"children":473},{},[474,479,481,487],{"type":43,"tag":57,"props":475,"children":477},{"className":476},[],[478],{"type":48,"value":62},{"type":48,"value":480}," via ",{"type":43,"tag":57,"props":482,"children":484},{"className":483},[],[485],{"type":48,"value":486},"Microsoft.Bcl.TimeProvider",{"type":48,"value":488}," NuGet",{"type":43,"tag":256,"props":490,"children":491},{},[492,494],{"type":48,"value":493},"Custom ",{"type":43,"tag":57,"props":495,"children":497},{"className":496},[],[498],{"type":48,"value":499},"ISystemClock",{"type":43,"tag":229,"props":501,"children":502},{},[503,508,518,523],{"type":43,"tag":256,"props":504,"children":505},{},[506],{"type":48,"value":507},"File system",{"type":43,"tag":256,"props":509,"children":510},{},[511,516],{"type":43,"tag":57,"props":512,"children":514},{"className":513},[],[515],{"type":48,"value":120},{"type":48,"value":517}," (NuGet)",{"type":43,"tag":256,"props":519,"children":520},{},[521],{"type":48,"value":522},"Same",{"type":43,"tag":256,"props":524,"children":525},{},[526],{"type":48,"value":522},{"type":43,"tag":229,"props":528,"children":529},{},[530,535,544,548],{"type":43,"tag":256,"props":531,"children":532},{},[533],{"type":48,"value":534},"HTTP",{"type":43,"tag":256,"props":536,"children":537},{},[538,543],{"type":43,"tag":57,"props":539,"children":541},{"className":540},[],[542],{"type":48,"value":70},{"type":48,"value":470},{"type":43,"tag":256,"props":545,"children":546},{},[547],{"type":48,"value":522},{"type":43,"tag":256,"props":549,"children":550},{},[551],{"type":48,"value":522},{"type":43,"tag":229,"props":553,"children":554},{},[555,560,570,574],{"type":43,"tag":256,"props":556,"children":557},{},[558],{"type":48,"value":559},"Environment",{"type":43,"tag":256,"props":561,"children":562},{},[563,564],{"type":48,"value":493},{"type":43,"tag":57,"props":565,"children":567},{"className":566},[],[568],{"type":48,"value":569},"IEnvironmentProvider",{"type":43,"tag":256,"props":571,"children":572},{},[573],{"type":48,"value":522},{"type":43,"tag":256,"props":575,"children":576},{},[577],{"type":48,"value":522},{"type":43,"tag":229,"props":579,"children":580},{},[581,586,596,600],{"type":43,"tag":256,"props":582,"children":583},{},[584],{"type":48,"value":585},"Console",{"type":43,"tag":256,"props":587,"children":588},{},[589,590],{"type":48,"value":493},{"type":43,"tag":57,"props":591,"children":593},{"className":592},[],[594],{"type":48,"value":595},"IConsole",{"type":43,"tag":256,"props":597,"children":598},{},[599],{"type":48,"value":522},{"type":43,"tag":256,"props":601,"children":602},{},[603],{"type":48,"value":522},{"type":43,"tag":229,"props":605,"children":606},{},[607,612,622,626],{"type":43,"tag":256,"props":608,"children":609},{},[610],{"type":48,"value":611},"Process",{"type":43,"tag":256,"props":613,"children":614},{},[615,616],{"type":48,"value":493},{"type":43,"tag":57,"props":617,"children":619},{"className":618},[],[620],{"type":48,"value":621},"IProcessRunner",{"type":43,"tag":256,"props":623,"children":624},{},[625],{"type":48,"value":522},{"type":43,"tag":256,"props":627,"children":628},{},[629],{"type":48,"value":522},{"type":43,"tag":51,"props":631,"children":632},{},[633,635,641,643,648,650,656],{"type":48,"value":634},"The table picks ",{"type":43,"tag":636,"props":637,"children":638},"em",{},[639],{"type":48,"value":640},"which abstraction",{"type":48,"value":642},". How it reaches the code under test is a separate axis: constructor\ninjection when a DI container exists, and the ",{"type":43,"tag":200,"props":644,"children":645},{},[646],{"type":48,"value":647},"ambient context seam of Step 5",{"type":48,"value":649}," when one does not. Decide that\naxis first — check for a host builder, ",{"type":43,"tag":57,"props":651,"children":653},{"className":652},[],[654],{"type":48,"value":655},"IServiceCollection",{"type":48,"value":657},", or an existing container registration — because a\nstatic class cannot take a constructor and a project without a container has nowhere to register anything. In\nthat case skip Steps 2–4 and go to Step 5; the abstraction chosen above still applies, it is just reached through\nthe ambient seam.",{"type":43,"tag":410,"props":659,"children":661},{"id":660},"step-2-generate-built-in-abstraction-adoption-time-http",[662],{"type":48,"value":663},"Step 2: Generate built-in abstraction adoption (Time, HTTP)",{"type":43,"tag":665,"props":666,"children":668},"h4",{"id":667},"timeprovider-net-8",[669],{"type":48,"value":670},"TimeProvider (.NET 8+)",{"type":43,"tag":51,"props":672,"children":673},{},[674],{"type":48,"value":675},"No wrapper code needed — guide the user:",{"type":43,"tag":677,"props":678,"children":679},"ol",{},[680],{"type":43,"tag":85,"props":681,"children":682},{},[683],{"type":48,"value":684},"Register in DI:",{"type":43,"tag":686,"props":687,"children":691},"pre",{"className":688,"code":689,"language":14,"meta":690,"style":690},"language-csharp shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","builder.Services.AddSingleton(TimeProvider.System);\n","",[692],{"type":43,"tag":57,"props":693,"children":694},{"__ignoreMap":690},[695],{"type":43,"tag":696,"props":697,"children":700},"span",{"class":698,"line":699},"line",1,[701],{"type":43,"tag":696,"props":702,"children":703},{},[704],{"type":48,"value":689},{"type":43,"tag":677,"props":706,"children":708},{"start":707},2,[709],{"type":43,"tag":85,"props":710,"children":711},{},[712],{"type":48,"value":713},"Inject into classes:",{"type":43,"tag":686,"props":715,"children":717},{"className":688,"code":716,"language":14,"meta":690,"style":690},"public class OrderProcessor(TimeProvider timeProvider)\n{\n    public bool IsExpired(Order order)\n        => timeProvider.GetUtcNow() > order.ExpiresAt;\n}\n",[718],{"type":43,"tag":57,"props":719,"children":720},{"__ignoreMap":690},[721,729,737,746,755],{"type":43,"tag":696,"props":722,"children":723},{"class":698,"line":699},[724],{"type":43,"tag":696,"props":725,"children":726},{},[727],{"type":48,"value":728},"public class OrderProcessor(TimeProvider timeProvider)\n",{"type":43,"tag":696,"props":730,"children":731},{"class":698,"line":707},[732],{"type":43,"tag":696,"props":733,"children":734},{},[735],{"type":48,"value":736},"{\n",{"type":43,"tag":696,"props":738,"children":740},{"class":698,"line":739},3,[741],{"type":43,"tag":696,"props":742,"children":743},{},[744],{"type":48,"value":745},"    public bool IsExpired(Order order)\n",{"type":43,"tag":696,"props":747,"children":749},{"class":698,"line":748},4,[750],{"type":43,"tag":696,"props":751,"children":752},{},[753],{"type":48,"value":754},"        => timeProvider.GetUtcNow() > order.ExpiresAt;\n",{"type":43,"tag":696,"props":756,"children":758},{"class":698,"line":757},5,[759],{"type":43,"tag":696,"props":760,"children":761},{},[762],{"type":48,"value":763},"}\n",{"type":43,"tag":677,"props":765,"children":766},{"start":739},[767],{"type":43,"tag":85,"props":768,"children":769},{},[770,772,778],{"type":48,"value":771},"Test with ",{"type":43,"tag":57,"props":773,"children":775},{"className":774},[],[776],{"type":48,"value":777},"FakeTimeProvider",{"type":48,"value":779},":",{"type":43,"tag":686,"props":781,"children":783},{"className":688,"code":782,"language":14,"meta":690,"style":690},"\u002F\u002F Requires Microsoft.Extensions.TimeProvider.Testing NuGet\nvar fakeTime = new FakeTimeProvider(new DateTimeOffset(2026, 1, 15, 0, 0, 0, TimeSpan.Zero));\nvar processor = new OrderProcessor(fakeTime);\nfakeTime.Advance(TimeSpan.FromDays(1));\nAssert.True(processor.IsExpired(order));\n",[784],{"type":43,"tag":57,"props":785,"children":786},{"__ignoreMap":690},[787,795,803,811,819],{"type":43,"tag":696,"props":788,"children":789},{"class":698,"line":699},[790],{"type":43,"tag":696,"props":791,"children":792},{},[793],{"type":48,"value":794},"\u002F\u002F Requires Microsoft.Extensions.TimeProvider.Testing NuGet\n",{"type":43,"tag":696,"props":796,"children":797},{"class":698,"line":707},[798],{"type":43,"tag":696,"props":799,"children":800},{},[801],{"type":48,"value":802},"var fakeTime = new FakeTimeProvider(new DateTimeOffset(2026, 1, 15, 0, 0, 0, TimeSpan.Zero));\n",{"type":43,"tag":696,"props":804,"children":805},{"class":698,"line":739},[806],{"type":43,"tag":696,"props":807,"children":808},{},[809],{"type":48,"value":810},"var processor = new OrderProcessor(fakeTime);\n",{"type":43,"tag":696,"props":812,"children":813},{"class":698,"line":748},[814],{"type":43,"tag":696,"props":815,"children":816},{},[817],{"type":48,"value":818},"fakeTime.Advance(TimeSpan.FromDays(1));\n",{"type":43,"tag":696,"props":820,"children":821},{"class":698,"line":757},[822],{"type":43,"tag":696,"props":823,"children":824},{},[825],{"type":48,"value":826},"Assert.True(processor.IsExpired(order));\n",{"type":43,"tag":665,"props":828,"children":830},{"id":829},"timeprovider-pre-net-8",[831],{"type":48,"value":832},"TimeProvider (pre-.NET 8)",{"type":43,"tag":51,"props":834,"children":835},{},[836,838,843],{"type":48,"value":837},"Guide: install ",{"type":43,"tag":57,"props":839,"children":841},{"className":840},[],[842],{"type":48,"value":486},{"type":48,"value":844}," NuGet. Same API as above.",{"type":43,"tag":665,"props":846,"children":848},{"id":847},"ihttpclientfactory",[849],{"type":48,"value":70},{"type":43,"tag":51,"props":851,"children":852},{},[853,855,861,863,869],{"type":48,"value":854},"No wrapper code needed — register typed clients via ",{"type":43,"tag":57,"props":856,"children":858},{"className":857},[],[859],{"type":48,"value":860},"builder.Services.AddHttpClient\u003CMyService>()",{"type":48,"value":862}," and inject ",{"type":43,"tag":57,"props":864,"children":866},{"className":865},[],[867],{"type":48,"value":868},"HttpClient",{"type":48,"value":870}," directly into the class constructor.",{"type":43,"tag":410,"props":872,"children":874},{"id":873},"step-3-generate-custom-wrappers-environment-console-process",[875],{"type":48,"value":876},"Step 3: Generate custom wrappers (Environment, Console, Process)",{"type":43,"tag":51,"props":878,"children":879},{},[880],{"type":48,"value":881},"For categories without built-in abstractions, follow this template:",{"type":43,"tag":665,"props":883,"children":885},{"id":884},"interface-define-the-minimal-surface",[886],{"type":48,"value":887},"Interface — define the minimal surface",{"type":43,"tag":51,"props":889,"children":890},{},[891],{"type":48,"value":892},"Only include methods that were actually detected in the codebase. Do NOT generate a wrapper for every possible member — wrap only what is used.",{"type":43,"tag":686,"props":894,"children":896},{"className":688,"code":895,"language":14,"meta":690,"style":690},"namespace \u003CNamespace>;\n\n\u002F\u002F\u002F \u003Csummary>\n\u002F\u002F\u002F Abstraction over \u003Cstatic class> for testability. \n\u002F\u002F\u002F \u003C\u002Fsummary>\npublic interface I\u003CWrapperName>\n{\n    \u002F\u002F One method per detected static call\n    \u003Creturn type> \u003CMethodName>(\u003Cparameters>);\n}\n",[897],{"type":43,"tag":57,"props":898,"children":899},{"__ignoreMap":690},[900,908,917,925,933,941,950,958,967,976],{"type":43,"tag":696,"props":901,"children":902},{"class":698,"line":699},[903],{"type":43,"tag":696,"props":904,"children":905},{},[906],{"type":48,"value":907},"namespace \u003CNamespace>;\n",{"type":43,"tag":696,"props":909,"children":910},{"class":698,"line":707},[911],{"type":43,"tag":696,"props":912,"children":914},{"emptyLinePlaceholder":913},true,[915],{"type":48,"value":916},"\n",{"type":43,"tag":696,"props":918,"children":919},{"class":698,"line":739},[920],{"type":43,"tag":696,"props":921,"children":922},{},[923],{"type":48,"value":924},"\u002F\u002F\u002F \u003Csummary>\n",{"type":43,"tag":696,"props":926,"children":927},{"class":698,"line":748},[928],{"type":43,"tag":696,"props":929,"children":930},{},[931],{"type":48,"value":932},"\u002F\u002F\u002F Abstraction over \u003Cstatic class> for testability. \n",{"type":43,"tag":696,"props":934,"children":935},{"class":698,"line":757},[936],{"type":43,"tag":696,"props":937,"children":938},{},[939],{"type":48,"value":940},"\u002F\u002F\u002F \u003C\u002Fsummary>\n",{"type":43,"tag":696,"props":942,"children":944},{"class":698,"line":943},6,[945],{"type":43,"tag":696,"props":946,"children":947},{},[948],{"type":48,"value":949},"public interface I\u003CWrapperName>\n",{"type":43,"tag":696,"props":951,"children":953},{"class":698,"line":952},7,[954],{"type":43,"tag":696,"props":955,"children":956},{},[957],{"type":48,"value":736},{"type":43,"tag":696,"props":959,"children":961},{"class":698,"line":960},8,[962],{"type":43,"tag":696,"props":963,"children":964},{},[965],{"type":48,"value":966},"    \u002F\u002F One method per detected static call\n",{"type":43,"tag":696,"props":968,"children":970},{"class":698,"line":969},9,[971],{"type":43,"tag":696,"props":972,"children":973},{},[974],{"type":48,"value":975},"    \u003Creturn type> \u003CMethodName>(\u003Cparameters>);\n",{"type":43,"tag":696,"props":977,"children":979},{"class":698,"line":978},10,[980],{"type":43,"tag":696,"props":981,"children":982},{},[983],{"type":48,"value":763},{"type":43,"tag":665,"props":985,"children":987},{"id":986},"default-implementation-delegate-to-the-real-static",[988],{"type":48,"value":989},"Default implementation — delegate to the real static",{"type":43,"tag":686,"props":991,"children":993},{"className":688,"code":992,"language":14,"meta":690,"style":690},"namespace \u003CNamespace>;\n\n\u002F\u002F\u002F \u003Csummary>\n\u002F\u002F\u002F Default implementation that delegates to \u003Cstatic class>.\n\u002F\u002F\u002F \u003C\u002Fsummary>\npublic sealed class \u003CWrapperName> : I\u003CWrapperName>\n{\n    public \u003Creturn type> \u003CMethodName>(\u003Cparameters>)\n        => \u003CStaticClass>.\u003CMethod>(\u003Carguments>);\n}\n",[994],{"type":43,"tag":57,"props":995,"children":996},{"__ignoreMap":690},[997,1004,1011,1018,1026,1033,1041,1048,1056,1064],{"type":43,"tag":696,"props":998,"children":999},{"class":698,"line":699},[1000],{"type":43,"tag":696,"props":1001,"children":1002},{},[1003],{"type":48,"value":907},{"type":43,"tag":696,"props":1005,"children":1006},{"class":698,"line":707},[1007],{"type":43,"tag":696,"props":1008,"children":1009},{"emptyLinePlaceholder":913},[1010],{"type":48,"value":916},{"type":43,"tag":696,"props":1012,"children":1013},{"class":698,"line":739},[1014],{"type":43,"tag":696,"props":1015,"children":1016},{},[1017],{"type":48,"value":924},{"type":43,"tag":696,"props":1019,"children":1020},{"class":698,"line":748},[1021],{"type":43,"tag":696,"props":1022,"children":1023},{},[1024],{"type":48,"value":1025},"\u002F\u002F\u002F Default implementation that delegates to \u003Cstatic class>.\n",{"type":43,"tag":696,"props":1027,"children":1028},{"class":698,"line":757},[1029],{"type":43,"tag":696,"props":1030,"children":1031},{},[1032],{"type":48,"value":940},{"type":43,"tag":696,"props":1034,"children":1035},{"class":698,"line":943},[1036],{"type":43,"tag":696,"props":1037,"children":1038},{},[1039],{"type":48,"value":1040},"public sealed class \u003CWrapperName> : I\u003CWrapperName>\n",{"type":43,"tag":696,"props":1042,"children":1043},{"class":698,"line":952},[1044],{"type":43,"tag":696,"props":1045,"children":1046},{},[1047],{"type":48,"value":736},{"type":43,"tag":696,"props":1049,"children":1050},{"class":698,"line":960},[1051],{"type":43,"tag":696,"props":1052,"children":1053},{},[1054],{"type":48,"value":1055},"    public \u003Creturn type> \u003CMethodName>(\u003Cparameters>)\n",{"type":43,"tag":696,"props":1057,"children":1058},{"class":698,"line":969},[1059],{"type":43,"tag":696,"props":1060,"children":1061},{},[1062],{"type":48,"value":1063},"        => \u003CStaticClass>.\u003CMethod>(\u003Carguments>);\n",{"type":43,"tag":696,"props":1065,"children":1066},{"class":698,"line":978},[1067],{"type":43,"tag":696,"props":1068,"children":1069},{},[1070],{"type":48,"value":763},{"type":43,"tag":665,"props":1072,"children":1074},{"id":1073},"di-registration",[1075],{"type":48,"value":1076},"DI registration",{"type":43,"tag":686,"props":1078,"children":1080},{"className":688,"code":1079,"language":14,"meta":690,"style":690},"\u002F\u002F In Program.cs or Startup.cs:\nbuilder.Services.AddSingleton\u003CI\u003CWrapperName>, \u003CWrapperName>>();\n",[1081],{"type":43,"tag":57,"props":1082,"children":1083},{"__ignoreMap":690},[1084,1092],{"type":43,"tag":696,"props":1085,"children":1086},{"class":698,"line":699},[1087],{"type":43,"tag":696,"props":1088,"children":1089},{},[1090],{"type":48,"value":1091},"\u002F\u002F In Program.cs or Startup.cs:\n",{"type":43,"tag":696,"props":1093,"children":1094},{"class":698,"line":707},[1095],{"type":43,"tag":696,"props":1096,"children":1097},{},[1098],{"type":48,"value":1099},"builder.Services.AddSingleton\u003CI\u003CWrapperName>, \u003CWrapperName>>();\n",{"type":43,"tag":410,"props":1101,"children":1103},{"id":1102},"step-4-generate-file-system-wrapper-adoption",[1104],{"type":48,"value":1105},"Step 4: Generate file system wrapper adoption",{"type":43,"tag":51,"props":1107,"children":1108},{},[1109,1111,1116],{"type":48,"value":1110},"Prefer the established ",{"type":43,"tag":57,"props":1112,"children":1114},{"className":1113},[],[1115],{"type":48,"value":120},{"type":48,"value":1117}," NuGet package over custom wrappers:",{"type":43,"tag":677,"props":1119,"children":1120},{},[1121],{"type":43,"tag":85,"props":1122,"children":1123},{},[1124],{"type":48,"value":1125},"Install the package:",{"type":43,"tag":686,"props":1127,"children":1131},{"className":1128,"code":1130,"language":48},[1129],"language-text","dotnet add package System.IO.Abstractions\n",[1132],{"type":43,"tag":57,"props":1133,"children":1134},{"__ignoreMap":690},[1135],{"type":48,"value":1130},{"type":43,"tag":677,"props":1137,"children":1138},{"start":707},[1139],{"type":43,"tag":85,"props":1140,"children":1141},{},[1142],{"type":48,"value":684},{"type":43,"tag":686,"props":1144,"children":1146},{"className":688,"code":1145,"language":14,"meta":690,"style":690},"builder.Services.AddSingleton\u003CIFileSystem, FileSystem>();\n",[1147],{"type":43,"tag":57,"props":1148,"children":1149},{"__ignoreMap":690},[1150],{"type":43,"tag":696,"props":1151,"children":1152},{"class":698,"line":699},[1153],{"type":43,"tag":696,"props":1154,"children":1155},{},[1156],{"type":48,"value":1145},{"type":43,"tag":677,"props":1158,"children":1159},{"start":739},[1160],{"type":43,"tag":85,"props":1161,"children":1162},{},[1163,1165,1171],{"type":48,"value":1164},"Inject ",{"type":43,"tag":57,"props":1166,"children":1168},{"className":1167},[],[1169],{"type":48,"value":1170},"IFileSystem",{"type":48,"value":1172}," into classes:",{"type":43,"tag":686,"props":1174,"children":1176},{"className":688,"code":1175,"language":14,"meta":690,"style":690},"public class ConfigLoader(IFileSystem fileSystem)\n{\n    public string LoadConfig(string path)\n        => fileSystem.File.ReadAllText(path);\n}\n",[1177],{"type":43,"tag":57,"props":1178,"children":1179},{"__ignoreMap":690},[1180,1188,1195,1203,1211],{"type":43,"tag":696,"props":1181,"children":1182},{"class":698,"line":699},[1183],{"type":43,"tag":696,"props":1184,"children":1185},{},[1186],{"type":48,"value":1187},"public class ConfigLoader(IFileSystem fileSystem)\n",{"type":43,"tag":696,"props":1189,"children":1190},{"class":698,"line":707},[1191],{"type":43,"tag":696,"props":1192,"children":1193},{},[1194],{"type":48,"value":736},{"type":43,"tag":696,"props":1196,"children":1197},{"class":698,"line":739},[1198],{"type":43,"tag":696,"props":1199,"children":1200},{},[1201],{"type":48,"value":1202},"    public string LoadConfig(string path)\n",{"type":43,"tag":696,"props":1204,"children":1205},{"class":698,"line":748},[1206],{"type":43,"tag":696,"props":1207,"children":1208},{},[1209],{"type":48,"value":1210},"        => fileSystem.File.ReadAllText(path);\n",{"type":43,"tag":696,"props":1212,"children":1213},{"class":698,"line":757},[1214],{"type":43,"tag":696,"props":1215,"children":1216},{},[1217],{"type":48,"value":763},{"type":43,"tag":677,"props":1219,"children":1220},{"start":748},[1221],{"type":43,"tag":85,"props":1222,"children":1223},{},[1224,1225,1231],{"type":48,"value":771},{"type":43,"tag":57,"props":1226,"children":1228},{"className":1227},[],[1229],{"type":48,"value":1230},"MockFileSystem",{"type":48,"value":779},{"type":43,"tag":686,"props":1233,"children":1236},{"className":1234,"code":1235,"language":48},[1129],"dotnet add \u003CTestProject> package System.IO.Abstractions.TestingHelpers\n",[1237],{"type":43,"tag":57,"props":1238,"children":1239},{"__ignoreMap":690},[1240],{"type":48,"value":1235},{"type":43,"tag":686,"props":1242,"children":1244},{"className":688,"code":1243,"language":14,"meta":690,"style":690},"var mockFs = new MockFileSystem(new Dictionary\u003Cstring, MockFileData>\n{\n    { \"\u002Fconfig.json\", new MockFileData(\"{\\\"key\\\": \\\"value\\\"}\") }\n});\nvar loader = new ConfigLoader(mockFs);\nAssert.Equal(\"{\\\"key\\\": \\\"value\\\"}\", loader.LoadConfig(\"\u002Fconfig.json\"));\n",[1245],{"type":43,"tag":57,"props":1246,"children":1247},{"__ignoreMap":690},[1248,1256,1263,1271,1279,1287],{"type":43,"tag":696,"props":1249,"children":1250},{"class":698,"line":699},[1251],{"type":43,"tag":696,"props":1252,"children":1253},{},[1254],{"type":48,"value":1255},"var mockFs = new MockFileSystem(new Dictionary\u003Cstring, MockFileData>\n",{"type":43,"tag":696,"props":1257,"children":1258},{"class":698,"line":707},[1259],{"type":43,"tag":696,"props":1260,"children":1261},{},[1262],{"type":48,"value":736},{"type":43,"tag":696,"props":1264,"children":1265},{"class":698,"line":739},[1266],{"type":43,"tag":696,"props":1267,"children":1268},{},[1269],{"type":48,"value":1270},"    { \"\u002Fconfig.json\", new MockFileData(\"{\\\"key\\\": \\\"value\\\"}\") }\n",{"type":43,"tag":696,"props":1272,"children":1273},{"class":698,"line":748},[1274],{"type":43,"tag":696,"props":1275,"children":1276},{},[1277],{"type":48,"value":1278},"});\n",{"type":43,"tag":696,"props":1280,"children":1281},{"class":698,"line":757},[1282],{"type":43,"tag":696,"props":1283,"children":1284},{},[1285],{"type":48,"value":1286},"var loader = new ConfigLoader(mockFs);\n",{"type":43,"tag":696,"props":1288,"children":1289},{"class":698,"line":943},[1290],{"type":43,"tag":696,"props":1291,"children":1292},{},[1293],{"type":48,"value":1294},"Assert.Equal(\"{\\\"key\\\": \\\"value\\\"}\", loader.LoadConfig(\"\u002Fconfig.json\"));\n",{"type":43,"tag":410,"props":1296,"children":1298},{"id":1297},"step-5-generate-ambient-context-alternative-when-di-is-not-available",[1299],{"type":48,"value":1300},"Step 5: Generate ambient context alternative (when DI is not available)",{"type":43,"tag":51,"props":1302,"children":1303},{},[1304],{"type":48,"value":1305},"If the codebase does not use DI (e.g., old console app, library code), offer the ambient context pattern:",{"type":43,"tag":686,"props":1307,"children":1309},{"className":688,"code":1308,"language":14,"meta":690,"style":690},"public static class Clock\n{\n    private static readonly AsyncLocal\u003CFunc\u003CDateTimeOffset>?> s_override = new();\n    public static DateTimeOffset UtcNow\n        => s_override.Value?.Invoke() ?? TimeProvider.System.GetUtcNow();\n\n    public static IDisposable Override(DateTimeOffset fixedTime)\n    {\n        s_override.Value = () => fixedTime;\n        return new Scope();\n    }\n    private sealed class Scope : IDisposable\n    {\n        public void Dispose() => s_override.Value = null;\n    }\n}\n",[1310],{"type":43,"tag":57,"props":1311,"children":1312},{"__ignoreMap":690},[1313,1321,1328,1336,1344,1352,1359,1367,1375,1383,1391,1400,1409,1417,1426,1434],{"type":43,"tag":696,"props":1314,"children":1315},{"class":698,"line":699},[1316],{"type":43,"tag":696,"props":1317,"children":1318},{},[1319],{"type":48,"value":1320},"public static class Clock\n",{"type":43,"tag":696,"props":1322,"children":1323},{"class":698,"line":707},[1324],{"type":43,"tag":696,"props":1325,"children":1326},{},[1327],{"type":48,"value":736},{"type":43,"tag":696,"props":1329,"children":1330},{"class":698,"line":739},[1331],{"type":43,"tag":696,"props":1332,"children":1333},{},[1334],{"type":48,"value":1335},"    private static readonly AsyncLocal\u003CFunc\u003CDateTimeOffset>?> s_override = new();\n",{"type":43,"tag":696,"props":1337,"children":1338},{"class":698,"line":748},[1339],{"type":43,"tag":696,"props":1340,"children":1341},{},[1342],{"type":48,"value":1343},"    public static DateTimeOffset UtcNow\n",{"type":43,"tag":696,"props":1345,"children":1346},{"class":698,"line":757},[1347],{"type":43,"tag":696,"props":1348,"children":1349},{},[1350],{"type":48,"value":1351},"        => s_override.Value?.Invoke() ?? TimeProvider.System.GetUtcNow();\n",{"type":43,"tag":696,"props":1353,"children":1354},{"class":698,"line":943},[1355],{"type":43,"tag":696,"props":1356,"children":1357},{"emptyLinePlaceholder":913},[1358],{"type":48,"value":916},{"type":43,"tag":696,"props":1360,"children":1361},{"class":698,"line":952},[1362],{"type":43,"tag":696,"props":1363,"children":1364},{},[1365],{"type":48,"value":1366},"    public static IDisposable Override(DateTimeOffset fixedTime)\n",{"type":43,"tag":696,"props":1368,"children":1369},{"class":698,"line":960},[1370],{"type":43,"tag":696,"props":1371,"children":1372},{},[1373],{"type":48,"value":1374},"    {\n",{"type":43,"tag":696,"props":1376,"children":1377},{"class":698,"line":969},[1378],{"type":43,"tag":696,"props":1379,"children":1380},{},[1381],{"type":48,"value":1382},"        s_override.Value = () => fixedTime;\n",{"type":43,"tag":696,"props":1384,"children":1385},{"class":698,"line":978},[1386],{"type":43,"tag":696,"props":1387,"children":1388},{},[1389],{"type":48,"value":1390},"        return new Scope();\n",{"type":43,"tag":696,"props":1392,"children":1394},{"class":698,"line":1393},11,[1395],{"type":43,"tag":696,"props":1396,"children":1397},{},[1398],{"type":48,"value":1399},"    }\n",{"type":43,"tag":696,"props":1401,"children":1403},{"class":698,"line":1402},12,[1404],{"type":43,"tag":696,"props":1405,"children":1406},{},[1407],{"type":48,"value":1408},"    private sealed class Scope : IDisposable\n",{"type":43,"tag":696,"props":1410,"children":1412},{"class":698,"line":1411},13,[1413],{"type":43,"tag":696,"props":1414,"children":1415},{},[1416],{"type":48,"value":1374},{"type":43,"tag":696,"props":1418,"children":1420},{"class":698,"line":1419},14,[1421],{"type":43,"tag":696,"props":1422,"children":1423},{},[1424],{"type":48,"value":1425},"        public void Dispose() => s_override.Value = null;\n",{"type":43,"tag":696,"props":1427,"children":1429},{"class":698,"line":1428},15,[1430],{"type":43,"tag":696,"props":1431,"children":1432},{},[1433],{"type":48,"value":1399},{"type":43,"tag":696,"props":1435,"children":1437},{"class":698,"line":1436},16,[1438],{"type":43,"tag":696,"props":1439,"children":1440},{},[1441],{"type":48,"value":763},{"type":43,"tag":51,"props":1443,"children":1444},{},[1445,1447,1453,1455,1461],{"type":48,"value":1446},"Key trade-offs: ",{"type":43,"tag":57,"props":1448,"children":1450},{"className":1449},[],[1451],{"type":48,"value":1452},"AsyncLocal\u003CT>",{"type":48,"value":1454}," ensures parallel tests don't interfere; production cost is one null check per call; the ",{"type":43,"tag":57,"props":1456,"children":1458},{"className":1457},[],[1459],{"type":48,"value":1460},"static readonly",{"type":48,"value":1462}," field is essentially free.",{"type":43,"tag":51,"props":1464,"children":1465},{},[1466],{"type":48,"value":1467},"Three properties this pattern must keep, because each has broken a real migration:",{"type":43,"tag":81,"props":1469,"children":1470},{},[1471,1505,1545],{"type":43,"tag":85,"props":1472,"children":1473},{},[1474,1479,1481,1487,1489,1495,1497,1503],{"type":43,"tag":200,"props":1475,"children":1476},{},[1477],{"type":48,"value":1478},"Scope the override and make it reversible.",{"type":48,"value":1480}," Return an ",{"type":43,"tag":57,"props":1482,"children":1484},{"className":1483},[],[1485],{"type":48,"value":1486},"IDisposable",{"type":48,"value":1488}," that restores the previous value, so a test cannot leak a pinned time into the next one. A bare setter, or a manual ",{"type":43,"tag":57,"props":1490,"children":1492},{"className":1491},[],[1493],{"type":48,"value":1494},"try",{"type":48,"value":1496},"\u002F",{"type":43,"tag":57,"props":1498,"children":1500},{"className":1499},[],[1501],{"type":48,"value":1502},"finally",{"type":48,"value":1504}," at each call site, puts that burden on every test author.",{"type":43,"tag":85,"props":1506,"children":1507},{},[1508,1528,1530,1535,1537,1543],{"type":43,"tag":200,"props":1509,"children":1510},{},[1511,1513,1518,1520,1526],{"type":48,"value":1512},"Use ",{"type":43,"tag":57,"props":1514,"children":1516},{"className":1515},[],[1517],{"type":48,"value":1452},{"type":48,"value":1519},", never ",{"type":43,"tag":57,"props":1521,"children":1523},{"className":1522},[],[1524],{"type":48,"value":1525},"[ThreadStatic]",{"type":48,"value":1527},".",{"type":48,"value":1529}," ",{"type":43,"tag":57,"props":1531,"children":1533},{"className":1532},[],[1534],{"type":48,"value":1525},{"type":48,"value":1536}," does not flow across ",{"type":43,"tag":57,"props":1538,"children":1540},{"className":1539},[],[1541],{"type":48,"value":1542},"await",{"type":48,"value":1544},", so the override silently disappears mid-test.",{"type":43,"tag":85,"props":1546,"children":1547},{},[1548,1553,1555,1561,1563,1569,1571,1577,1579,1585,1587,1593,1594,1600],{"type":43,"tag":200,"props":1549,"children":1550},{},[1551],{"type":48,"value":1552},"Preserve the semantics of the member you are replacing.",{"type":48,"value":1554}," Substituting ",{"type":43,"tag":57,"props":1556,"children":1558},{"className":1557},[],[1559],{"type":48,"value":1560},"DateTime.UtcNow",{"type":48,"value":1562}," with a local-time source changes the ",{"type":43,"tag":57,"props":1564,"children":1566},{"className":1565},[],[1567],{"type":48,"value":1568},"DateTimeKind",{"type":48,"value":1570}," every existing caller and stored value depends on — pair ",{"type":43,"tag":57,"props":1572,"children":1574},{"className":1573},[],[1575],{"type":48,"value":1576},"UtcNow",{"type":48,"value":1578}," with ",{"type":43,"tag":57,"props":1580,"children":1582},{"className":1581},[],[1583],{"type":48,"value":1584},"GetUtcNow()",{"type":48,"value":1586},", and ",{"type":43,"tag":57,"props":1588,"children":1590},{"className":1589},[],[1591],{"type":48,"value":1592},"Now",{"type":48,"value":1578},{"type":43,"tag":57,"props":1595,"children":1597},{"className":1596},[],[1598],{"type":48,"value":1599},"GetLocalNow()",{"type":48,"value":1527},{"type":43,"tag":51,"props":1602,"children":1603},{},[1604,1606,1612],{"type":48,"value":1605},"The same shape works for non-time statics: swap ",{"type":43,"tag":57,"props":1607,"children":1609},{"className":1608},[],[1610],{"type":48,"value":1611},"TimeProvider.System.GetUtcNow()",{"type":48,"value":1613}," for the real static call and keep the override slot, the disposable scope, and the original semantics.",{"type":43,"tag":410,"props":1615,"children":1617},{"id":1616},"step-6-place-generated-files",[1618],{"type":48,"value":1619},"Step 6: Place generated files",{"type":43,"tag":51,"props":1621,"children":1622},{},[1623],{"type":48,"value":1624},"Generate files following the project's existing conventions:",{"type":43,"tag":81,"props":1626,"children":1627},{},[1628,1649,1668],{"type":43,"tag":85,"props":1629,"children":1630},{},[1631,1633,1639,1641,1647],{"type":48,"value":1632},"If there is an ",{"type":43,"tag":57,"props":1634,"children":1636},{"className":1635},[],[1637],{"type":48,"value":1638},"Abstractions\u002F",{"type":48,"value":1640}," or ",{"type":43,"tag":57,"props":1642,"children":1644},{"className":1643},[],[1645],{"type":48,"value":1646},"Interfaces\u002F",{"type":48,"value":1648}," folder, place the interface there",{"type":43,"tag":85,"props":1650,"children":1651},{},[1652,1653,1659,1660,1666],{"type":48,"value":1632},{"type":43,"tag":57,"props":1654,"children":1656},{"className":1655},[],[1657],{"type":48,"value":1658},"Infrastructure\u002F",{"type":48,"value":1640},{"type":43,"tag":57,"props":1661,"children":1663},{"className":1662},[],[1664],{"type":48,"value":1665},"Services\u002F",{"type":48,"value":1667}," folder, place the implementation there",{"type":43,"tag":85,"props":1669,"children":1670},{},[1671],{"type":48,"value":1672},"Otherwise, create files next to the code that uses the static",{"type":43,"tag":51,"props":1674,"children":1675},{},[1676],{"type":48,"value":1677},"Always generate:",{"type":43,"tag":677,"props":1679,"children":1680},{},[1681,1686,1691],{"type":43,"tag":85,"props":1682,"children":1683},{},[1684],{"type":48,"value":1685},"The interface file (or adoption instructions for built-in abstractions)",{"type":43,"tag":85,"props":1687,"children":1688},{},[1689],{"type":48,"value":1690},"The default implementation file",{"type":43,"tag":85,"props":1692,"children":1693},{},[1694,1696,1701],{"type":48,"value":1695},"The DI registration snippet (as a code comment at the bottom of the implementation, or as separate instructions) — ",{"type":43,"tag":200,"props":1697,"children":1698},{},[1699],{"type":48,"value":1700},"skip this one entirely on the ambient-seam path",{"type":48,"value":1702},": there is no container to register into, and offering one anyway is the failure mode that made a user ask for the seam in the first place",{"type":43,"tag":74,"props":1704,"children":1706},{"id":1705},"validation",[1707],{"type":48,"value":1708},"Validation",{"type":43,"tag":81,"props":1710,"children":1713},{"className":1711},[1712],"contains-task-list",[1714,1726,1735,1760,1769,1790,1813],{"type":43,"tag":85,"props":1715,"children":1718},{"className":1716},[1717],"task-list-item",[1719,1724],{"type":43,"tag":1720,"props":1721,"children":1723},"input",{"disabled":913,"type":1722},"checkbox",[],{"type":48,"value":1725}," Generated interface only wraps statics that were actually detected (not speculative)",{"type":43,"tag":85,"props":1727,"children":1729},{"className":1728},[1717],[1730,1733],{"type":43,"tag":1720,"props":1731,"children":1732},{"disabled":913,"type":1722},[],{"type":48,"value":1734}," Default implementation delegates to the real static with no behavior changes",{"type":43,"tag":85,"props":1736,"children":1738},{"className":1737},[1717],[1739,1742,1744,1750,1752,1758],{"type":43,"tag":1720,"props":1740,"children":1741},{"disabled":913,"type":1722},[],{"type":48,"value":1743}," DI registration uses ",{"type":43,"tag":57,"props":1745,"children":1747},{"className":1746},[],[1748],{"type":48,"value":1749},"AddSingleton",{"type":48,"value":1751}," for stateless wrappers, ",{"type":43,"tag":57,"props":1753,"children":1755},{"className":1754},[],[1756],{"type":48,"value":1757},"AddTransient",{"type":48,"value":1759}," for stateful ones",{"type":43,"tag":85,"props":1761,"children":1763},{"className":1762},[1717],[1764,1767],{"type":43,"tag":1720,"props":1765,"children":1766},{"disabled":913,"type":1722},[],{"type":48,"value":1768}," NuGet packages are recommended where established libraries exist (System.IO.Abstractions, etc.)",{"type":43,"tag":85,"props":1770,"children":1772},{"className":1771},[1717],[1773,1776,1778,1783,1785],{"type":43,"tag":1720,"props":1774,"children":1775},{"disabled":913,"type":1722},[],{"type":48,"value":1777}," For .NET 8+, ",{"type":43,"tag":57,"props":1779,"children":1781},{"className":1780},[],[1782],{"type":48,"value":62},{"type":48,"value":1784}," is recommended over custom ",{"type":43,"tag":57,"props":1786,"children":1788},{"className":1787},[],[1789],{"type":48,"value":499},{"type":43,"tag":85,"props":1791,"children":1793},{"className":1792},[1717],[1794,1797,1799,1804,1806,1811],{"type":43,"tag":1720,"props":1795,"children":1796},{"disabled":913,"type":1722},[],{"type":48,"value":1798}," Ambient context pattern includes ",{"type":43,"tag":57,"props":1800,"children":1802},{"className":1801},[],[1803],{"type":48,"value":1452},{"type":48,"value":1805},", a scoped ",{"type":43,"tag":57,"props":1807,"children":1809},{"className":1808},[],[1810],{"type":48,"value":1486},{"type":48,"value":1812}," that restores the previous value, and trade-off explanation",{"type":43,"tag":85,"props":1814,"children":1816},{"className":1815},[1717],[1817,1820,1822,1827,1829,1834,1836,1841,1843,1848],{"type":43,"tag":1720,"props":1818,"children":1819},{"disabled":913,"type":1722},[],{"type":48,"value":1821}," On the ambient-seam path, no ",{"type":43,"tag":57,"props":1823,"children":1825},{"className":1824},[],[1826],{"type":48,"value":655},{"type":48,"value":1828}," registration is proposed and the replaced member's semantics (",{"type":43,"tag":57,"props":1830,"children":1832},{"className":1831},[],[1833],{"type":48,"value":1576},{"type":48,"value":1835}," vs ",{"type":43,"tag":57,"props":1837,"children":1839},{"className":1838},[],[1840],{"type":48,"value":1592},{"type":48,"value":1842},", and its ",{"type":43,"tag":57,"props":1844,"children":1846},{"className":1845},[],[1847],{"type":48,"value":1568},{"type":48,"value":1849},") are preserved",{"type":43,"tag":74,"props":1851,"children":1853},{"id":1852},"common-pitfalls",[1854],{"type":48,"value":1855},"Common Pitfalls",{"type":43,"tag":221,"props":1857,"children":1858},{},[1859,1875],{"type":43,"tag":225,"props":1860,"children":1861},{},[1862],{"type":43,"tag":229,"props":1863,"children":1864},{},[1865,1870],{"type":43,"tag":233,"props":1866,"children":1867},{},[1868],{"type":48,"value":1869},"Pitfall",{"type":43,"tag":233,"props":1871,"children":1872},{},[1873],{"type":48,"value":1874},"Solution",{"type":43,"tag":249,"props":1876,"children":1877},{},[1878,1891,1904,1924,1944,1962,1989],{"type":43,"tag":229,"props":1879,"children":1880},{},[1881,1886],{"type":43,"tag":256,"props":1882,"children":1883},{},[1884],{"type":48,"value":1885},"Declining because the project has no DI container",{"type":43,"tag":256,"props":1887,"children":1888},{},[1889],{"type":48,"value":1890},"The ambient seam in Step 5 is the answer for that case — offer it instead of asking the user to adopt a container",{"type":43,"tag":229,"props":1892,"children":1893},{},[1894,1899],{"type":43,"tag":256,"props":1895,"children":1896},{},[1897],{"type":48,"value":1898},"Wrapping ALL members of a static class",{"type":43,"tag":256,"props":1900,"children":1901},{},[1902],{"type":48,"value":1903},"Only wrap methods actually called in the codebase",{"type":43,"tag":229,"props":1905,"children":1906},{},[1907,1912],{"type":43,"tag":256,"props":1908,"children":1909},{},[1910],{"type":48,"value":1911},"Custom time wrapper on .NET 8+",{"type":43,"tag":256,"props":1913,"children":1914},{},[1915,1917,1922],{"type":48,"value":1916},"Use built-in ",{"type":43,"tag":57,"props":1918,"children":1920},{"className":1919},[],[1921],{"type":48,"value":62},{"type":48,"value":1923}," instead",{"type":43,"tag":229,"props":1925,"children":1926},{},[1927,1932],{"type":43,"tag":256,"props":1928,"children":1929},{},[1930],{"type":48,"value":1931},"Custom file system wrapper",{"type":43,"tag":256,"props":1933,"children":1934},{},[1935,1937,1942],{"type":48,"value":1936},"Prefer ",{"type":43,"tag":57,"props":1938,"children":1940},{"className":1939},[],[1941],{"type":48,"value":120},{"type":48,"value":1943}," NuGet — battle-tested, complete",{"type":43,"tag":229,"props":1945,"children":1946},{},[1947,1952],{"type":43,"tag":256,"props":1948,"children":1949},{},[1950],{"type":48,"value":1951},"Registering scoped when singleton suffices",{"type":43,"tag":256,"props":1953,"children":1954},{},[1955,1957],{"type":48,"value":1956},"Stateless wrappers should be ",{"type":43,"tag":57,"props":1958,"children":1960},{"className":1959},[],[1961],{"type":48,"value":1749},{"type":43,"tag":229,"props":1963,"children":1964},{},[1965,1970],{"type":43,"tag":256,"props":1966,"children":1967},{},[1968],{"type":48,"value":1969},"Forgetting test helper packages",{"type":43,"tag":256,"props":1971,"children":1972},{},[1973,1979,1981,1987],{"type":43,"tag":57,"props":1974,"children":1976},{"className":1975},[],[1977],{"type":48,"value":1978},"Microsoft.Extensions.TimeProvider.Testing",{"type":48,"value":1980}," for time, ",{"type":43,"tag":57,"props":1982,"children":1984},{"className":1983},[],[1985],{"type":48,"value":1986},"System.IO.Abstractions.TestingHelpers",{"type":48,"value":1988}," for filesystem",{"type":43,"tag":229,"props":1990,"children":1991},{},[1992,2003],{"type":43,"tag":256,"props":1993,"children":1994},{},[1995,1997],{"type":48,"value":1996},"Ambient context without ",{"type":43,"tag":57,"props":1998,"children":2000},{"className":1999},[],[2001],{"type":48,"value":2002},"AsyncLocal",{"type":43,"tag":256,"props":2004,"children":2005},{},[2006,2008,2013,2015,2021,2022,2027,2029],{"type":48,"value":2007},"Non-async ",{"type":43,"tag":57,"props":2009,"children":2011},{"className":2010},[],[2012],{"type":48,"value":1525},{"type":48,"value":2014}," breaks with ",{"type":43,"tag":57,"props":2016,"children":2018},{"className":2017},[],[2019],{"type":48,"value":2020},"async",{"type":48,"value":1496},{"type":43,"tag":57,"props":2023,"children":2025},{"className":2024},[],[2026],{"type":48,"value":1542},{"type":48,"value":2028}," — always use ",{"type":43,"tag":57,"props":2030,"children":2032},{"className":2031},[],[2033],{"type":48,"value":1452},{"type":43,"tag":2035,"props":2036,"children":2037},"style",{},[2038],{"type":48,"value":2039},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2041,"total":2201},[2042,2058,2073,2087,2105,2117,2135,2145,2157,2167,2180,2191],{"slug":2043,"name":2043,"fn":2044,"description":2045,"org":2046,"tags":2047,"stars":2055,"repoUrl":2056,"updatedAt":2057},"multithreaded-task-migration","migrate MSBuild tasks to multithreaded mode","Guide for migrating MSBuild tasks to multithreaded mode support, including compatibility red-team review. Use this when converting tasks to thread-safe versions, implementing IMultiThreadableTask, adding TaskEnvironment support, or auditing migrations for behavioral compatibility.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2048,2049,2052],{"name":20,"slug":21,"type":15},{"name":2050,"slug":2051,"type":15},"Engineering","engineering",{"name":2053,"slug":2054,"type":15},"Performance","performance",5535,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild","2026-07-22T05:37:33.965588",{"slug":2059,"name":2059,"fn":2060,"description":2061,"org":2062,"tags":2063,"stars":25,"repoUrl":26,"updatedAt":2072},"analyzing-dotnet-performance","analyze .NET code for performance anti-patterns","Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I\u002FO with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2064,2065,2068,2071],{"name":20,"slug":21,"type":15},{"name":2066,"slug":2067,"type":15},"Code Analysis","code-analysis",{"name":2069,"slug":2070,"type":15},"Debugging","debugging",{"name":2053,"slug":2054,"type":15},"2026-07-12T08:23:25.400375",{"slug":2074,"name":2074,"fn":2075,"description":2076,"org":2077,"tags":2078,"stars":25,"repoUrl":26,"updatedAt":2086},"android-tombstone-symbolication","symbolicate .NET runtime frames in Android tombstones","Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java\u002FKotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2079,2080,2083,2084],{"name":20,"slug":21,"type":15},{"name":2081,"slug":2082,"type":15},"Android","android",{"name":2069,"slug":2070,"type":15},{"name":2085,"slug":368,"type":15},"Microsoft","2026-07-12T08:23:21.595572",{"slug":2088,"name":2088,"fn":2089,"description":2090,"org":2091,"tags":2092,"stars":25,"repoUrl":26,"updatedAt":2104},"apple-crash-symbolication","symbolicate .NET runtime frames in crash logs","Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift\u002FObjective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2093,2094,2095,2098,2101],{"name":20,"slug":21,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2096,"slug":2097,"type":15},"iOS","ios",{"name":2099,"slug":2100,"type":15},"macOS","macos",{"name":2102,"slug":2103,"type":15},"Observability","observability","2026-07-12T08:23:20.369986",{"slug":2106,"name":2106,"fn":2107,"description":2108,"org":2109,"tags":2110,"stars":25,"repoUrl":26,"updatedAt":2116},"assertion-quality","evaluate assertion quality in test suites","Analyzes the variety and depth of assertions across test suites in any language. Use when the user asks to evaluate assertion quality, find shallow tests, identify assertion-free tests (no assertions or only trivial ones like Assert.IsNotNull \u002F toBeTruthy()), flag self-referential or tautological assertions, measure assertion diversity, or audit whether tests verify different facets of behavior. Polyglot: .NET, Python, TS\u002FJS, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, C++. DO NOT USE FOR: writing new tests (use code-testing-agent \u002F writing-mstest-tests), mutation reasoning about whether tests would catch a bug (use test-gap-analysis), or a general severity-ranked anti-pattern audit (use test-anti-patterns), fixing or rewriting assertions, or writing, fixing, or modernizing MSTest tests, assertions, or attributes (use writing-mstest-tests).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2111,2112,2115],{"name":2066,"slug":2067,"type":15},{"name":2113,"slug":2114,"type":15},"QA","qa",{"name":23,"slug":24,"type":15},"2026-07-12T08:23:51.277743",{"slug":2118,"name":2118,"fn":2119,"description":2120,"org":2121,"tags":2122,"stars":25,"repoUrl":26,"updatedAt":2134},"author-component","create and review Blazor components","Create or review Blazor components (.razor files) with correct architecture. USE FOR: writing new Blazor components that do NOT involve JavaScript interop, implementing parameters and EventCallback, RenderFragment slots, component lifecycle (OnInitializedAsync, OnParametersSet), async patterns, IAsyncDisposable, CancellationToken, CSS isolation, code-behind. DO NOT USE FOR: creating new projects (use create-blazor-project), JavaScript interop or calling browser APIs from Blazor (use use-js-interop), forms and validation (use collect-user-input), prerendering issues (use support-prerendering), HTTP data fetching patterns (use fetch-and-send-data), coordinating state between unrelated components (use coordinate-components).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2123,2124,2127,2128,2131],{"name":20,"slug":21,"type":15},{"name":2125,"slug":2126,"type":15},"Blazor","blazor",{"name":13,"slug":14,"type":15},{"name":2129,"slug":2130,"type":15},"UI Components","ui-components",{"name":2132,"slug":2133,"type":15},"Web Development","web-development","2026-07-15T06:03:29.216359",{"slug":2136,"name":2136,"fn":2137,"description":2138,"org":2139,"tags":2140,"stars":25,"repoUrl":26,"updatedAt":2144},"binlog-failure-analysis","analyze MSBuild binary logs","Analyze MSBuild binary logs to diagnose build failures. USE FOR: build errors that are unclear from console output, diagnosing cascading failures across multi-project builds, tracing MSBuild target execution order, and generally any MSBuild build issues. Requires an existing .binlog file. DO NOT USE FOR: generating binlogs (use binlog-generation), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2141,2142,2143],{"name":2066,"slug":2067,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2085,"slug":368,"type":15},"2026-07-12T08:21:34.637923",{"slug":2146,"name":2146,"fn":2147,"description":2148,"org":2149,"tags":2150,"stars":25,"repoUrl":26,"updatedAt":2156},"binlog-generation","generate MSBuild binary logs for diagnostics","Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding \u002Fbl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ \u002F .NET 8 SDK+ for {} placeholder; PowerShell needs -bl:{{}}. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2151,2154,2155],{"name":2152,"slug":2153,"type":15},"Build","build",{"name":2069,"slug":2070,"type":15},{"name":2050,"slug":2051,"type":15},"2026-07-19T05:38:19.340791",{"slug":2158,"name":2158,"fn":2159,"description":2160,"org":2161,"tags":2162,"stars":25,"repoUrl":26,"updatedAt":2166},"build-parallelism","optimize MSBuild build parallelism","Diagnose and fix under-parallelized MSBuild builds. USE WHEN a multi-project solution build is slower than expected, doesn't speed up when you add cores, pegs a single core while others idle, or you want to know why `-m` isn't helping. Note: `\u002Fmaxcpucount` default is 1 (sequential) — always pass `-m` for parallel builds. Covers finding the critical path (longest serial ProjectReference chain), graph build (`\u002Fgraph`), BuildInParallel, and solution filters (`.slnf`). DO NOT USE FOR: single-project builds, incremental issues (use incremental-build), compilation slowness inside one project (use build-perf-diagnostics), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2163,2164,2165],{"name":20,"slug":21,"type":15},{"name":2050,"slug":2051,"type":15},{"name":2053,"slug":2054,"type":15},"2026-07-19T05:38:18.364937",{"slug":2168,"name":2168,"fn":2169,"description":2170,"org":2171,"tags":2172,"stars":25,"repoUrl":26,"updatedAt":2179},"build-perf-baseline","establish and optimize build performance baselines","Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like MSBuild Server, static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2173,2174,2177,2178],{"name":2050,"slug":2051,"type":15},{"name":2175,"slug":2176,"type":15},"Monitoring","monitoring",{"name":2053,"slug":2054,"type":15},{"name":23,"slug":24,"type":15},"2026-07-12T08:21:35.865649",{"slug":2181,"name":2181,"fn":2182,"description":2183,"org":2184,"tags":2185,"stars":25,"repoUrl":26,"updatedAt":2190},"build-perf-diagnostics","diagnose MSBuild build performance bottlenecks","Diagnose MSBuild build performance bottlenecks using binary log analysis. USE FOR: identifying why builds are slow by analyzing binlog performance summaries, detecting ResolveAssemblyReference (RAR) taking >5s, Roslyn analyzers consuming >30% of Csc time, single targets dominating >50% of build time, node utilization below 80%, excessive Copy tasks, NuGet restore running every build. Covers timeline analysis, Target\u002FTask Performance Summary interpretation, and 7 common bottleneck categories. Use after build-perf-baseline has established measurements. DO NOT USE FOR: establishing initial baselines (use build-perf-baseline first), fixing incremental build issues (use incremental-build), parallelism tuning (use build-parallelism), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2186,2187,2188,2189],{"name":20,"slug":21,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2050,"slug":2051,"type":15},{"name":2053,"slug":2054,"type":15},"2026-07-12T08:21:40.961722",{"slug":2192,"name":2192,"fn":2193,"description":2194,"org":2195,"tags":2196,"stars":25,"repoUrl":26,"updatedAt":2200},"check-bin-obj-clash","detect MSBuild output path conflicts","Detects MSBuild projects with conflicting OutputPath or IntermediateOutputPath. USE FOR: builds failing with 'Cannot create a file when that file already exists', 'The process cannot access the file because it is being used by another process', intermittent build failures that succeed on retry, or missing\u002Foverwritten outputs in multi-project or multi-targeting builds where bin\u002Fobj (or project.assets.json) collide. Common causes: shared OutputPath, missing AppendTargetFrameworkToOutputPath, extra global properties (e.g. PublishReadyToRun), or SetTargetFramework on a ProjectReference to a single-targeting project. DO NOT USE FOR: file access errors unrelated to MSBuild (OS-level locking), single-project single-TFM builds, non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2197,2198,2199],{"name":2069,"slug":2070,"type":15},{"name":2050,"slug":2051,"type":15},{"name":2113,"slug":2114,"type":15},"2026-07-19T05:38:14.336279",144,{"items":2203,"total":2252},[2204,2211,2218,2226,2232,2240,2246],{"slug":2059,"name":2059,"fn":2060,"description":2061,"org":2205,"tags":2206,"stars":25,"repoUrl":26,"updatedAt":2072},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2207,2208,2209,2210],{"name":20,"slug":21,"type":15},{"name":2066,"slug":2067,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2053,"slug":2054,"type":15},{"slug":2074,"name":2074,"fn":2075,"description":2076,"org":2212,"tags":2213,"stars":25,"repoUrl":26,"updatedAt":2086},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2214,2215,2216,2217],{"name":20,"slug":21,"type":15},{"name":2081,"slug":2082,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2085,"slug":368,"type":15},{"slug":2088,"name":2088,"fn":2089,"description":2090,"org":2219,"tags":2220,"stars":25,"repoUrl":26,"updatedAt":2104},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2221,2222,2223,2224,2225],{"name":20,"slug":21,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2096,"slug":2097,"type":15},{"name":2099,"slug":2100,"type":15},{"name":2102,"slug":2103,"type":15},{"slug":2106,"name":2106,"fn":2107,"description":2108,"org":2227,"tags":2228,"stars":25,"repoUrl":26,"updatedAt":2116},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2229,2230,2231],{"name":2066,"slug":2067,"type":15},{"name":2113,"slug":2114,"type":15},{"name":23,"slug":24,"type":15},{"slug":2118,"name":2118,"fn":2119,"description":2120,"org":2233,"tags":2234,"stars":25,"repoUrl":26,"updatedAt":2134},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2235,2236,2237,2238,2239],{"name":20,"slug":21,"type":15},{"name":2125,"slug":2126,"type":15},{"name":13,"slug":14,"type":15},{"name":2129,"slug":2130,"type":15},{"name":2132,"slug":2133,"type":15},{"slug":2136,"name":2136,"fn":2137,"description":2138,"org":2241,"tags":2242,"stars":25,"repoUrl":26,"updatedAt":2144},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2243,2244,2245],{"name":2066,"slug":2067,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2085,"slug":368,"type":15},{"slug":2146,"name":2146,"fn":2147,"description":2148,"org":2247,"tags":2248,"stars":25,"repoUrl":26,"updatedAt":2156},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2249,2250,2251],{"name":2152,"slug":2153,"type":15},{"name":2069,"slug":2070,"type":15},{"name":2050,"slug":2051,"type":15},96]