dotnet / dotnet/maui

Add Analyzer to warn about implement IDisposable on types registered into your services

Open
#28,810 0 comments 0 reactions 0 assignees View on GitHub
area-core-hosting perf/general s/triaged
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

We've seen a number of issues where users will register transient types into the Service Provider but then they implement IDisposable on those types.

When you do this, the service provider is going to hold a reference to these types forever

https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines#example-anti-patterns

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named in the issue. Start by locating the repository's analyzer infrastructure and read the linked dependency-injection guidance; done means a diagnostic warns when a transient service registration involves a type implementing IDisposable, with coverage for the relevant registration cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.