Azure / Azure/azure-sdk-tools

[.NET Analyzer] Warn customers to dispose model types that implement IDisposable

Open
#1,798 0 comments 0 reactions 0 assignees View on GitHub
API Analyzer
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

Any model type that wraps a raw network stream (like `BlobClient.DownloadStreaming`) returns a `Response` where `T` implements `IDisposable`. We're not going to make `Response` implement `IDisposable` itself because it's so rarely required. It's harder to notice something needs to be disposed though so we should suggest it with an analyzer.

Contributor guide

Open the contributing guide

Research direction

Start by locating the .NET analyzer entry point and its existing analyzer tests, then inspect the BlobClient.DownloadStreaming Response case described here. Define the expected warning for model types whose T implements IDisposable and add a test showing when disposal should be suggested.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.