Fallout-build/Fallout

Optional: Roslyn codefix to auto-rename IHaz* references on CS0618

已关闭

#242 创建于 2026年5月28日

 (0 条评论) (0 个反应) (0 位负责人)C# (16 个派生)github user discovery
good first issuetarget/2027

仓库指标

星标
 (125 个星标)
PR 合并指标
 (平均合并 2天 15小时) (30 天内合并 63 个 PR)

描述

Why

Follow-up to #120, which ships [Obsolete] IHaz* alias interfaces in Nuke.Components. With the aliases in place, the C# compiler already emits CS0618 at every legacy reference site, with an actionable message pointing at the renamed IHas* form. Consumers can fix manually one-by-one.

A Roslyn codefix attached to CS0618 (for these specific obsolete types) would close the loop — Visual Studio / VS Code light bulb offers a one-click rename. Pure convenience; not required for the migration to function.

Action

  • Add an analyzer/codefix to Fallout.Migrate.Analyzers that:
    • Listens for CS0618 diagnostics whose target type is one of the 9 Nuke.Components.IHaz* aliases
    • Offers a codefix to rewrite the identifier to the corresponding IHas* form
  • Cover all 9 aliases (mirror the table in #120)
  • Tests using the existing analyzer-test pattern (Verify snapshots)
  • Assign the next sequential FALLOUT00x diagnostic ID after the existing family

Why this is optional

The compiler already provides the warning. The codefix is a UX nicety, not a correctness requirement. If it never lands, consumers can:

  • Use VS / Rider's built-in "Rename" refactoring after manually changing one occurrence
  • Run a regex find-and-replace
  • Run fallout-migrate (if that CLI ends up covering this rename — separate scope)

Done when

  • Analyzer + codefix shipped in Fallout.Migrate.Analyzers
  • VS / Rider light bulb appears on IHaz* references with a one-click rename
  • Snapshot tests cover all 9 aliases

贡献者指南