Skip to content

feat: L1 migration scaffold improvements shims, .targets, and script enhancements#526

Merged
csharpfritz merged 3 commits intoFritzAndFriends:devfrom
csharpfritz:feature/l1-migration-scaffold-improvements
Mar 27, 2026
Merged

feat: L1 migration scaffold improvements shims, .targets, and script enhancements#526
csharpfritz merged 3 commits intoFritzAndFriends:devfrom
csharpfritz:feature/l1-migration-scaffold-improvements

Conversation

@csharpfritz
Copy link
Copy Markdown
Collaborator

Summary

Dramatically reduces L1 (mechanical transform) build errors by shipping type aliases, shim types, and compilation helpers with the BWFC NuGet package, plus improving the migration script's transform pipeline.

WingtipToys test migration: 372 baseline errors 382 remaining (all genuine L2 issues; zero L1 infrastructure errors)

What's Included

BWFC Library New Types

Type Namespace Purpose
QueryStringAttribute BlazorWebFormsComponents [QueryString("id")] compiles on method params; L2 promotes to [SupplyParameterFromQuery] property
RouteDataAttribute BlazorWebFormsComponents [RouteData] compiles on method params; L2 promotes to [Parameter] property
GridViewRow (non-generic) BlazorWebFormsComponents Bridges GridViewRow vs GridViewRow<T> gap for migrated code
IdentityUser, IdentityResult, UserLoginInfo BlazorWebFormsComponents.Identity ASP.NET Identity v2 data type stubs
ApplicationUserManager, ApplicationSignInManager BlazorWebFormsComponents.Identity Virtual no-op stubs (see #525 for delegation)
SignInStatus BlazorWebFormsComponents.Identity Enum shim
IdentityDbContext<TUser> BlazorWebFormsComponents.Identity EF6 Identity DbContext stub
DropCreateDatabaseIfModelChanges<T> BlazorWebFormsComponents.EntityFramework EF6 database initializer stub
Database BlazorWebFormsComponents.EntityFramework Database.SetInitializer<T>() no-op

BWFC Library .targets File

New Fritz.BlazorWebFormsComponents.targets ships in both build/ and buildTransitive/ for NuGet consumers:

  • Type aliases: Page WebFormsPageBase, MasterPage LayoutComponentBase, ImageClickEventArgs MouseEventArgs
  • Namespace imports: BlazorWebFormsComponents, LoginControls, Identity, EntityFramework
  • Migration-mode suppression (opt-in via <BwfcMigrationMode>true</BwfcMigrationMode>): CS8618, CS0414, CS0067, CS0612, IDE0007

Migration Script (bwfc-migrate.ps1)

  • GlobalUsings.cs slimmed to Blazor infrastructure only (aliases handled by .targets)
  • Base class stripping: : Page, : MasterPage, : UserControl removed from code-behind class declarations (Razor @inherits handles inheritance)
  • Attribute preservation: [QueryString] and [RouteData] left as-is (BWFC shim attributes compile)
  • Using-stripping: System.Web.*, Microsoft.AspNet.*, Microsoft.Owin.*, Owin removed from code-behinds, models, and BLL files
  • Conditional AJAX: @using BlazorAjaxToolkitComponents only added when AJAX controls detected
  • BwfcMigrationMode auto-set in generated .csproj
  • WebFormsShims.cs and IdentityShims.cs generation removed (types now in library)

Test Reports

  • dev-docs/migration-tests/wingtiptoys/run22/ Baseline full migration
  • dev-docs/migration-tests/wingtiptoys/run23/ First L1 improvements
  • dev-docs/migration-tests/wingtiptoys/run24/ EntityFramework shims + base class stripping
  • dev-docs/migration-tests/wingtiptoys/run25/ GridViewRow + QueryString/RouteData attributes

Related

csharpfritz and others added 3 commits March 26, 2026 11:58
- Add .targets file shipping type aliases (Page, MasterPage, ImageClickEventArgs)
  and namespace imports with the BWFC NuGet package
- Add Identity compatibility types to BWFC library (BlazorWebFormsComponents.Identity):
  IdentityUser, IdentityResult, UserLoginInfo, ApplicationUserManager,
  ApplicationSignInManager, SignInStatus  virtual no-op stubs for issue FritzAndFriends#525
- Improve bwfc-migrate.ps1 L1 script:
  - Generate slimmed GlobalUsings.cs (Blazor infrastructure only)
  - Strip Microsoft.AspNet.*, Microsoft.Owin.*, Owin usings in all copy paths
  - Replace fully-qualified System.Web.UI base classes with alias-compatible names
  - Conditional @using BlazorAjaxToolkitComponents (only when detected)
  - Remove _Imports.razor hardcoded BlazorAjaxToolkitComponents
  - Remove WebFormsShims.cs and IdentityShims.cs generation (types now in library)
- Add migration test reports (run22: full migration, run23: L1 improvements)

WingtipToys L1 baseline: 372 errors  32 errors (91% reduction)
Remaining 32 are genuine L2 issues (unclosed HTML, EF6 types, template params)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pression

- Add BlazorWebFormsComponents.EntityFramework namespace with
  DropCreateDatabaseIfModelChanges<T> and Database.SetInitializer<T> stubs
- Add IdentityDbContext<T> shim in Identity namespace
- Strip base class declarations (: Page, : MasterPage, : UserControl) from
  code-behinds since .razor @inherits handles inheritance
- Add RZ9980/RZ9981/RZ9996/CS0612 to BwfcMigrationMode warning suppression
- Auto-set BwfcMigrationMode=true in generated .csproj
- Add EntityFramework namespace to .targets global usings
- WingtipToys errors: 372 -> 3 (99.2% reduction)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…007 suppression

- Add non-generic GridViewRow shim class for Web Forms compatibility (CS0305 fix)
- Add [QueryString] and [RouteData] attributes targeting method parameters so
  L1 script preserves original Web Forms attributes instead of converting them
- Add IDE0007 to BwfcMigrationMode warning suppression (style, not functional)
- Update L1 script to preserve [QueryString]/[RouteData] (no conversion needed)
- Eliminates CS0305 and CS0592 errors; 382 remaining are genuine L2 issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@csharpfritz csharpfritz merged commit 07d09a5 into FritzAndFriends:dev Mar 27, 2026
4 checks passed
@csharpfritz csharpfritz deleted the feature/l1-migration-scaffold-improvements branch March 27, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant