Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup DoNotUseWhenAllOrWaitAllWithSingleArgument #5060

Merged
merged 2 commits into from
Apr 23, 2021

Conversation

Youssef1313
Copy link
Member

Quick follow-up to #4841

  • Removed unnecessary derived classes.
  • Used non-localized equivalence key.
  • Renamed all contexts to `context.
  • Used SymbolEqualityComparer.Default

cc: @ryzngard

@Youssef1313 Youssef1313 requested a review from a team as a code owner April 23, 2021 10:53
@Youssef1313
Copy link
Member Author

Youssef1313 commented Apr 23, 2021

@mavasani I'm unable to debug the failure.

Locally, the tests fail with: NuGet.Packaging.Core.PackagingException : The package is missing the required nuspec file. Path: C:\Users\Youssef\AppData\Local\Temp\test-packages\Microsoft.NETCore.App.Ref.3.1.0

I have no clue how to fix this. :/ Deleting test-packages folder fixed it.

But the behavior of IOperation API looks very strange:

image

Is that a bug in the operation tree?

@codecov
Copy link

codecov bot commented Apr 23, 2021

Codecov Report

Merging #5060 (0b5e5c1) into release/6.0.1xx-preview4 (535cbe7) will increase coverage by 0.00%.
The diff coverage is 91.66%.

@@                    Coverage Diff                    @@
##           release/6.0.1xx-preview4    #5060   +/-   ##
=========================================================
  Coverage                     95.55%   95.56%           
=========================================================
  Files                          1205     1203    -2     
  Lines                        274343   274337    -6     
  Branches                      16632    16632           
=========================================================
+ Hits                         262151   262157    +6     
  Misses                         9988     9988           
+ Partials                       2204     2192   -12     

@Youssef1313 Youssef1313 reopened this Apr 23, 2021
@Youssef1313
Copy link
Member Author

Youssef1313 commented Apr 23, 2021

System.AggregateException : One or more errors occurred. (Unexpected Null)\n---- System.InvalidOperationException : Unexpected Null

TestCodeFixToEnableAnalyzerReleaseTracking failed 😕 , closing and re-opening

@Youssef1313 Youssef1313 reopened this Apr 23, 2021
@@ -12,7 +13,8 @@

namespace Microsoft.NetCore.Analyzers.Tasks
{
public abstract class DoNotUseWhenAllOrWaitAllWithSingleArgumentFixer : CodeFixProvider
[ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops 😅 I really thought I had this change in already. Thanks for fixing!

@@ -112,7 +112,8 @@ private static bool IsSingleTaskArgument(IInvocationOperation invocation, INamed
return false;
}

return namedTypeSymbol.Equals(taskType) || namedTypeSymbol.ConstructedFrom.Equals(genericTaskType);
return namedTypeSymbol.Equals(taskType, SymbolEqualityComparer.Default) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought symbol.Equals(otherSymbol) implicitly used the SymbolEqualityComparer.Default if available?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryzngard It does. But there is an analyzer (RS1024) to enforce using SymbolEqualityComparer explicitly to make the intent clear.

Currently the analyzer is disabled due to few bugs and will be re-enabled once they are fixed.

@ryzngard
Copy link
Contributor

@mavasani I'm unable to debug the failure.

Locally, the tests fail with: NuGet.Packaging.Core.PackagingException : The package is missing the required nuspec file. Path: C:\Users\Youssef\AppData\Local\Temp\test-packages\Microsoft.NETCore.App.Ref.3.1.0

I have no clue how to fix this. :/ Deleting test-packages folder fixed it.

But the behavior of IOperation API looks very strange:

image

Is that a bug in the operation tree?

It looks like you figured this out, but the Value being an implicitly generated IArrayCreationOperation changes the behavior slightly.

@ryzngard
Copy link
Contributor

Thanks for doing this!

@ryzngard ryzngard merged commit d515202 into dotnet:release/6.0.1xx-preview4 Apr 23, 2021
@Youssef1313 Youssef1313 deleted the cleanup branch April 23, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants