dotnet / dotnet/winforms

[Application Builder] Enable Designer-safe dependency injection and UI scopes

Open
#14,947 1 comment 0 reactions 0 assignees View on GitHub
Review Issue
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

## User story

As a WinForms developer, I want Forms, UserControls, and components to participate in dependency injection and well-defined UI scopes without breaking drag-and-drop Designer workflows.

## Rationale and user benefit

Constructor injection conflicts with parameterless design-time creation. Static service locators hide lifetime errors and make testing harder. A supported bridge must keep the out-of-process Designer, generated code, runtime activation, disposal, and scope ownership coherent.

## Scope boundary

Own Designer/runtime service assignment, activation and factory contracts, Form/UserControl/component scopes, disposal, and scope-aware navigation. Depend only on the minimum host contracts from the lifetime story. Do not own configuration providers, logging providers, or project templates.

## Acceptance criteria

- [ ] Drag-and-drop and generated Designer code continue to work.
- [ ] Runtime-created Forms and controls can resolve required services without a global static provider.
- [ ] Scope ownership and disposal are deterministic for Forms, modal dialogs, UserControls, and application contexts.
- [ ] Design-time service absence is explicit and does not leak into runtime behavior.
- [ ] Existing controls and components require no migration.
- [ ] Out-of-process Designer requirements are agreed with the Designer team.

## Definition of Done

- [ ] Public and Designer contracts are reviewed together.
- [ ] Runtime and Designer implementations, tests, samples, and migration guidance are complete.
- [ ] Disposal, nested scopes, exception paths, design-time detection, memory, and handle stability are validated.

## Parallelization

This is foundation stream B. Keep Designer/code-generation changes isolated from stream A's lifetime implementation and stream C's service integrations.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by reviewing the Designer/runtime service-assignment, activation, factory, and scope requirements, then coordinate the out-of-process Designer contract with the Designer team; done means reviewed public contracts, implementations, tests, samples, migration guidance, and validated disposal, nested scopes, design-time detection, memory, and handle stability.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.