Skip to content

Commit 3d00416

Browse files
csharpfritzCopilot
andcommitted
docs: add Roslyn analyzer documentation, samples, and examples
- Create docs/Migration/Analyzers.md with full reference for all 8 BWFC analyzers (BWFC001-005, BWFC010-012) including before/after code, code fix descriptions, installation guide, and .editorconfig configuration - Add analyzer sample page to AfterBlazorServerSide under MigrationTools/Analyzers with inline code examples - Create standalone BeforeFix/AfterFix example files showing full analyzer pass on realistic migrated code - Update mkdocs.yml nav and Migration readme with analyzer cross-references - Add Migration Tools nav category to sample app ComponentList Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d7d9ad4 commit 3d00416

11 files changed

Lines changed: 1249 additions & 0 deletions

File tree

.squad/agents/beast/history.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,3 +497,50 @@ Updated `.squad/skills/migration-standards/SKILL.md` to add new section at end:
497497
- Created docs/ValidationControls/BaseValidator.md
498498
- Created docs/ValidationControls/BaseCompareValidator.md
499499
- Updated mkdocs.yml (Validation Controls section)
500+
501+
### Roslyn Analyzer Suite Documentation (Current Session)
502+
503+
**Delivered:** Comprehensive MkDocs page documenting all 8 BWFC Roslyn analyzers with code fixes.
504+
505+
**File created:** `docs/Migration/Analyzers.md` (~17.7 KB)
506+
507+
**Content structure:**
508+
1. **Overview** — What the analyzer package is, how to install it, when to use it (post-migration)
509+
2. **Summary table** — All 8 rules with ID, severity, name, and brief description
510+
3. **Per-analyzer sections** (8 total, each with):
511+
- Rule ID, severity, category
512+
- What it detects (the problematic pattern from source code analysis)
513+
- Why it matters (migration context for Web Forms devs)
514+
- Before/after code examples (realistic, not toy)
515+
- Code fix description (what the automatic fix produces)
516+
4. **Configuration/suppression**`.editorconfig`, `#pragma warning`, `[SuppressMessage]`, bulk suppression strategy
517+
5. **Recommended workflow** — 6-step checklist tying analyzers into the migration pipeline
518+
519+
**Analyzer coverage:**
520+
- BWFC001: Missing [Parameter] attribute on WebControl properties
521+
- BWFC002: ViewState["key"] usage patterns → component state
522+
- BWFC003: IsPostBack checks → Blazor lifecycle methods
523+
- BWFC004: Response.Redirect() → NavigationManager.NavigateTo()
524+
- BWFC005: Session["key"] and HttpContext.Current → scoped services/ProtectedSessionStorage
525+
- BWFC010: Required attributes missing on BWFC components (GridView.DataSource, etc.)
526+
- BWFC011: Web Forms event handler signature (object, EventArgs) → EventCallback
527+
- BWFC012: Leftover runat="server" in string literals
528+
529+
**Additional updates:**
530+
- `mkdocs.yml` — added "Roslyn Analyzers: Migration/Analyzers.md" after "Automated Migration Guide"
531+
- `docs/Migration/readme.md` — added "Clean Up with Roslyn Analyzers" section with install command and link
532+
533+
**Key decisions:**
534+
- Placed after Automated Migration Guide in nav — developers run automation first, then use analyzers to clean up code-behind
535+
- Code fix examples show the literal output (TODO comments, commented-out code) so developers know what to expect
536+
- Tabbed before/after examples using `=== "Before"` / `=== "After"` pattern matching DeprecationGuidance.md style
537+
- Lifecycle mapping table in BWFC003 section shows IsPostBack → OnInitialized equivalence
538+
- Bulk suppression strategy section helps large codebases adopt analyzers incrementally
539+
- Cross-references to existing BWFC docs (ViewState utility, Response.Redirect utility) where relevant
540+
541+
**Learnings:**
542+
- Analyzer code fixes fall into two categories: (1) additive (BWFC001 adds [Parameter]), (2) commenting-out with TODO (BWFC002-005, BWFC011). The commenting pattern is intentional — these require human judgment for the replacement.
543+
- BWFC010 (RequiredAttributeAnalyzer) tracks a small set of components (GridView, HyperLink, Image) — extensible in future
544+
- BWFC012 (RunatServerAnalyzer) targets string literals, not markup — catches dynamically-built HTML, not .razor files
545+
- Source reading revealed team decision (2026-03-21): BWFC001 skips static properties — documented this in the analyzer description
546+
- MkDocs strict build passes with analyzer docs included (59.43s build time)

.squad/agents/jubilee/history.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,13 @@
205205
- **Build verified:** 0 errors.
206206

207207

208+
209+
### Analyzer Sample Content (2026-03-20)
210+
211+
- **Created Razor sample page** at `samples/AfterBlazorServerSide/Components/Pages/MigrationTools/Analyzers/Index.razor` informational/reference page covering all 8 BWFC analyzers (BWFC001-005, BWFC010-012) with installation instructions, summary table, and before/after code examples for each rule.
212+
- **Created before/after example files** at `samples/AnalyzerExamples/BeforeFix.cs.example` and `AfterFix.cs.example` realistic ProductManager code-behind showing every analyzer pattern in context.
213+
- **Added 'Migration Tools' nav category** to `ComponentList.razor` with link to Roslyn Analyzers page.
214+
- **Route pattern:** `/MigrationTools/Analyzers` new top-level route alongside `/ControlSamples/` and `/UtilityFeatures/` since analyzers are not controls or utility features.
215+
- **Convention for non-compilable examples:** Used `.cs.example` extension per task requirements to signal these are reference files, not build artifacts.
216+
- **Lesson:** Analyzer sample pages are educational/reference-style (like Theming) rather than interactive demo pages. No `@code` block needed since there's no interactive state.
217+
- **Build verified:** 0 errors.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Decision: Roslyn Analyzer Documentation Placement and Structure
2+
3+
**Author:** Beast (Technical Writer)
4+
**Date:** 2026-03-XX
5+
**Status:** Delivered
6+
7+
## Context
8+
9+
The BWFC project has 8 Roslyn analyzers with code fixes in `BlazorWebFormsComponents.Analyzers`. These needed comprehensive documentation for developers using the analyzer package post-migration.
10+
11+
## Decision
12+
13+
1. **Placement:** `docs/Migration/Analyzers.md` under the Migration section, positioned after "Automated Migration Guide" and before "Deprecation Guidance". Rationale: analyzers are a post-migration tool — developers run automation first, then use analyzers to clean up code-behind patterns the script couldn't address.
14+
15+
2. **Structure:** Each analyzer gets a dedicated section with: what it detects, why it matters, before/after code, and code fix description. This matches the pattern established in DeprecationGuidance.md.
16+
17+
3. **Cross-references:** Links to existing utility docs (ViewState, Response.Redirect) where the analyzer topic overlaps with a BWFC compatibility shim.
18+
19+
4. **Migration readme update:** Added "Clean Up with Roslyn Analyzers" section to `docs/Migration/readme.md` as a follow-up step in the migration journey.
20+
21+
## Impact
22+
23+
- New file: `docs/Migration/Analyzers.md` (~17.7 KB)
24+
- Updated: `mkdocs.yml` (nav entry), `docs/Migration/readme.md` (new section)
25+
- MkDocs strict build passes
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Decision: Analyzer Samples Use /MigrationTools/ Route
2+
3+
**Author:** Jubilee
4+
**Date:** 2026-03-20
5+
**Status:** Implemented
6+
7+
## Context
8+
Needed a sample page for the BWFC Roslyn analyzer suite. Analyzers are IDE tools, not UI components, so they don't fit under `/ControlSamples/` or `/UtilityFeatures/`.
9+
10+
## Decision
11+
Created a new `/MigrationTools/` route category with its own nav section in ComponentList.razor. The page at `/MigrationTools/Analyzers` is an informational/reference page (no interactive demos) following the educational style of the Theming page.
12+
13+
Standalone before/after example files use `.cs.example` extension in `samples/AnalyzerExamples/` to distinguish reference examples from compilable code.
14+
15+
## Impact
16+
- New nav category 'Migration Tools' in ComponentList.razor
17+
- Establishes pattern for future migration tooling pages (e.g., migration scripts, config helpers)

0 commit comments

Comments
 (0)