Skip to content

Commit

Permalink
S2930: Add FP repro for #8336 (#9047)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Pohlmann authored Apr 9, 2024
1 parent 752f59c commit d67b08b
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,28 @@ void Disposed(string filePath)
fileStream.Dispose();
}
}

public class Repro_8336_1 : IDisposable
{
private readonly CancellationTokenSource source;

public Repro_8336_1() =>
source = new CancellationTokenSource(); // Compliant

public void Dispose() =>
source.Dispose();
}

public class Repro_8336_2 : IDisposable
{
private readonly CancellationTokenSource source;

public Repro_8336_2() =>
source = new CancellationTokenSource(); // Noncompliant

public void Dispose()
{
// Did we forget to dispose something here?
}
}
}

0 comments on commit d67b08b

Please sign in to comment.