Skip to content

Commit c58b050

Browse files
Merge branch 'feature/v5.7.5'
2 parents 12be30c + 7d0cadc commit c58b050

File tree

8 files changed

+101
-18
lines changed

8 files changed

+101
-18
lines changed

Sources/ReCommendedExtension.Tests/Analyzers/AnnotationAnalyzerTestsForMsTestProjects.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected override bool HighlightingPredicate(IHighlighting highlighting, IPsiSo
1717
=> highlighting is MissingSuppressionJustificationWarning;
1818

1919
[Test]
20-
[TestPackages("MSTest.TestFramework")]
20+
[TestNetCore31("MSTest.TestFramework")]
2121
public void TestSuppressMessage_TestProject() => DoNamedTest2();
2222

2323
[Test]

Sources/ReCommendedExtension.Tests/Analyzers/AsyncVoidAnalyzerTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace ReCommendedExtension.Tests.Analyzers
1010
{
11-
[TestNetFramework45]
1211
[TestFixture]
1312
public sealed class AsyncVoidAnalyzerTests : CSharpHighlightingTestBase
1413
{
@@ -18,12 +17,19 @@ protected override bool HighlightingPredicate(IHighlighting highlighting, IPsiSo
1817
=> highlighting is AsyncVoidFunctionExpressionWarning || highlighting is AvoidAsyncVoidWarning;
1918

2019
[Test]
20+
[TestNetFramework45]
2121
public void TestAnonymousMethod() => DoNamedTest2();
2222

2323
[Test]
24+
[TestNetFramework45]
2425
public void TestLambdaExpression() => DoNamedTest2();
2526

2627
[Test]
28+
[TestNetFramework45]
2729
public void TestAsyncVoidMethod() => DoNamedTest2();
30+
31+
// [Test]
32+
// [TestNet60("Microsoft.WindowsAppSDK/1.1.4")]
33+
// public void TestAsyncVoidMethodXBind() => DoNamedTest2();
2834
}
2935
}

Sources/ReCommendedExtension.Tests/ReCommendedExtension.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="JetBrains.Lifetimes" Version="2022.2.1" />
20-
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2022.2.2">
20+
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2022.2.3">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
24+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
2525
<PackageReference Include="NUnit" Version="3.13.2" />
2626
</ItemGroup>
2727

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using JetBrains.Annotations;
4+
5+
namespace Test
6+
{
7+
internal partial class SamplePage : Microsoft.UI.Xaml.Controls.ContentControl
8+
{
9+
async void OnLoaded()
10+
{
11+
OtherMethod();
12+
}
13+
14+
async void OtherMethod() { }
15+
}
16+
17+
partial class SamplePage : Microsoft.UI.Xaml.Markup.IComponentConnector // SamplePage.g.cs
18+
{
19+
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.UI.Xaml.Markup.Compiler", " 1.0.0.0")]
20+
private class SamplePage_obj1_Bindings : Microsoft.UI.Xaml.Markup.IComponentConnector
21+
{
22+
private SamplePage dataRoot;
23+
private Microsoft.UI.Xaml.RoutedEventHandler obj1Loaded;
24+
25+
public void Connect(int connectionId, object target)
26+
{
27+
switch (connectionId)
28+
{
29+
case 1:
30+
this.obj1Loaded = (object p0, Microsoft.UI.Xaml.RoutedEventArgs p1) =>
31+
{
32+
this.dataRoot.OnLoaded();
33+
};
34+
(WinRT.CastExtensions.As<Microsoft.UI.Xaml.Controls.ContentControl>(target)).Loaded += obj1Loaded;
35+
break;
36+
}
37+
}
38+
}
39+
}
40+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using JetBrains.Annotations;
4+
5+
namespace Test
6+
{
7+
internal partial class SamplePage : Microsoft.UI.Xaml.Controls.ContentControl
8+
{
9+
async void OnLoaded()
10+
{
11+
OtherMethod();
12+
}
13+
14+
async |void|(0) OtherMethod() { }
15+
}
16+
17+
partial class SamplePage : Microsoft.UI.Xaml.Markup.IComponentConnector // SamplePage.g.cs
18+
{
19+
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.UI.Xaml.Markup.Compiler", " 1.0.0.0")]
20+
private class SamplePage_obj1_Bindings : Microsoft.UI.Xaml.Markup.IComponentConnector
21+
{
22+
private SamplePage dataRoot;
23+
private Microsoft.UI.Xaml.RoutedEventHandler obj1Loaded;
24+
25+
public void Connect(int connectionId, object target)
26+
{
27+
switch (connectionId)
28+
{
29+
case 1:
30+
this.obj1Loaded = (object p0, Microsoft.UI.Xaml.RoutedEventArgs p1) =>
31+
{
32+
this.dataRoot.OnLoaded();
33+
};
34+
(WinRT.CastExtensions.As<Microsoft.UI.Xaml.Controls.ContentControl>(target)).Loaded += obj1Loaded;
35+
break;
36+
}
37+
}
38+
}
39+
}
40+
}
41+
---------------------------------------------------------
42+
(0): ReSharper Warning: 'async void' method used 1 time not as a direct event handler.

Sources/ReCommendedExtension/Extensions.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -545,23 +545,18 @@ static IObjectCreationExpression TryGetDelegateCreation([NotNull] ICSharpArgumen
545545

546546
public static bool IsEventTarget([NotNull] this IReference reference)
547547
{
548-
var treeNode = reference.GetTreeNode();
549-
550-
if (treeNode.Parent is IAssignmentExpression assignmentExpression)
548+
switch (reference.GetTreeNode().Parent)
551549
{
552-
return assignmentExpression.IsEventSubscriptionOrUnSubscription();
553-
}
550+
case IAssignmentExpression assignmentExpression: return assignmentExpression.IsEventSubscriptionOrUnSubscription();
554551

555-
if (treeNode.Parent is ICSharpArgument argument)
556-
{
557-
var delegateCreation = TryGetDelegateCreation(argument);
558-
if (delegateCreation != null)
552+
case ICSharpArgument argument:
559553
{
560-
assignmentExpression = delegateCreation.Parent as IAssignmentExpression;
561-
if (assignmentExpression != null)
554+
var delegateCreation = TryGetDelegateCreation(argument);
555+
if (delegateCreation != null && delegateCreation.Parent is IAssignmentExpression assignmentExpression)
562556
{
563557
return assignmentExpression.IsEventSubscriptionOrUnSubscription();
564558
}
559+
break;
565560
}
566561
}
567562

Sources/ReCommendedExtension/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
[assembly: AssemblyTrademark("")]
1414
[assembly: AssemblyCulture("")]
1515

16-
[assembly: AssemblyVersion("5.7.4.0")]
17-
[assembly: AssemblyFileVersion("5.7.4")]
16+
[assembly: AssemblyVersion("5.7.5.0")]
17+
[assembly: AssemblyFileVersion("5.7.5")]

Sources/ReCommendedExtension/ReCommendedExtension.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<ItemGroup>
2222
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
23-
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2022.2.2">
23+
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2022.2.3">
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2626
</PackageReference>

0 commit comments

Comments
 (0)