Commit c4ffd7f 1 parent fb54e8b commit c4ffd7f Copy full SHA for c4ffd7f
File tree 4 files changed +55
-2
lines changed
4 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -663,6 +663,56 @@ int streamOperation()
663
663
VerifyCSharpDiagnostic ( test ) ;
664
664
}
665
665
666
+ [ Fact ]
667
+ public void UsingStatementWithDataflow2 ( )
668
+ {
669
+ var test = @"
670
+ using System;
671
+ using System.Threading.Tasks;
672
+
673
+ class Program
674
+ {
675
+ async Task foo()
676
+ {
677
+ using var stream = new MemoryStream();
678
+ int streamOperation()
679
+ {
680
+ var stream2 = new MemoryStream();
681
+ return stream2.Read(null);
682
+ }
683
+
684
+ stream.Read(null);
685
+ var t = Task.Run(() => streamOperation());
686
+ await t;
687
+ }
688
+ }" ;
689
+ var expected = new DiagnosticResult { Id = DiagnosticIds . UnnecessaryAsync } ;
690
+ VerifyCSharpDiagnostic ( test , expected ) ;
691
+
692
+ var fixtest = @"
693
+ using System;
694
+ using System.Threading.Tasks;
695
+
696
+ class Program
697
+ {
698
+ Task foo()
699
+ {
700
+ using var stream = new MemoryStream();
701
+ int streamOperation()
702
+ {
703
+ var stream2 = new MemoryStream();
704
+ return stream2.Read(null);
705
+ }
706
+
707
+ stream.Read(null);
708
+ var t = Task.Run(() => streamOperation());
709
+ return t;
710
+ }
711
+ }" ;
712
+
713
+ VerifyCSharpFix ( test , fixtest ) ;
714
+ }
715
+
666
716
[ Fact ( Skip = "TODO: fix the dataflow analysis to analyze all locations of the symbol, not only the definitions" ) ]
667
717
public void NoWarn_UsingStatementWithDataflowComplicated ( )
668
718
{
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<PackageManifest Version =" 2.0.0" xmlns =" http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns : d =" http://schemas.microsoft.com/developer/vsx-schema-design/2011" >
3
3
<Metadata >
4
- <Identity Id =" AsyncFixer.Vsix..edab5fce-e3aa-4fea-9d60-a07bc11d493b" Version =" 1.5.0 " Language =" en-US" Publisher =" Semih Okur" />
4
+ <Identity Id =" AsyncFixer.Vsix..edab5fce-e3aa-4fea-9d60-a07bc11d493b" Version =" 1.5.1 " Language =" en-US" Publisher =" Semih Okur" />
5
5
<DisplayName >AsyncFixer for Visual Studio 2019</DisplayName >
6
6
<Description xml : space =" preserve" >Advanced async/await Diagnostics and CodeFixes for C#.</Description >
7
7
<MoreInfo >http://www.asyncfixer.com</MoreInfo >
Original file line number Diff line number Diff line change 9
9
10
10
<PropertyGroup >
11
11
<PackageId >AsyncFixer</PackageId >
12
- <PackageVersion >1.5.0 </PackageVersion >
12
+ <PackageVersion >1.5.1 </PackageVersion >
13
13
<Authors >Semih Okur</Authors >
14
14
<Title >AsyncFixer: Advanced async/await Diagnostics and CodeFixes for C#</Title >
15
15
<Description >
Original file line number Diff line number Diff line change 1
1
# Release History
2
2
3
+ ## 1.5.1 (2021-01)
4
+ - 01.UnnecessaryAsync: Implemented a dataflow analysis for disposable objects to fix false-negatives and false-positives
5
+
3
6
## 1.5.0 (2021-01)
4
7
- 01.UnnecessaryAsync: Fix false-negatives to cover more cases
5
8
- 02.BlockingCallInsideAsync: Stop suggesting async calls for virtual calls and Dispose methods
You can’t perform that action at this time.
0 commit comments