Skip to content

feat: Add NonPageClassDetectTransform to detect non-page classes using Web Forms APIs #537

@csharpfritz

Description

@csharpfritz

Summary

Create a new CLI transform (NonPageClassDetectTransform) that detects classes using Web Forms API patterns (Session[], Response.Redirect, Server.MapPath, etc.) that do NOT inherit from WebFormsPageBase. These classes need constructor DI instead of base class shims.

Problem

Currently, all CLI transforms emit guidance like "works via WebFormsPageBase shim." This is correct for Razor page code-behind files, but wrong for non-page classes (helpers, services, utilities) that also use Web Forms APIs.

Proposed Solution

  • Order: 50 (runs early)
  • Detection: Check if class inherits from WebFormsPageBase/Page/System.Web.UI.Page
  • For non-page classes: Emit constructor DI guidance instead of shim guidance
  • Must be registered in BOTH Program.cs DI AND TestHelpers.CreateDefaultPipeline()
  • Should be idempotent

Anti-patterns

  • Don't create a WebFormsServiceBase
  • Don't auto-inject [Inject] properties into non-page classes

Context

Item 4 from migration toolkit improvement proposal (P1). Items 1-3 and 5-7 implemented in feature/toolkit-gap-detection branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions