提交 9fefd804 编写于 作者: M Manish Vasani

Move consumed analyzer packages to newly published version 2.9.5

Also fix violations from newly added rules.
上级 c350cf34
......@@ -27,7 +27,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
<RoslynDiagnosticsNugetPackageVersion>2.9.4</RoslynDiagnosticsNugetPackageVersion>
<RoslynDiagnosticsNugetPackageVersion>2.9.5</RoslynDiagnosticsNugetPackageVersion>
<CodeStyleLayerCodeAnalysisVersion>2.8.2</CodeStyleLayerCodeAnalysisVersion>
<MicrosoftCodeAnalysisTestingVersion>1.0.0-beta1-63310-01</MicrosoftCodeAnalysisTestingVersion>
<CodeStyleAnalyzerVersion>3.3.1-beta3-19454-05</CodeStyleAnalyzerVersion>
......
......@@ -21,6 +21,9 @@
<!-- Properties should not return arrays - not useful for tests -->
<Rule Id="CA1819" Action="None" />
<!-- Use Length/Count property instead of Count() when available - lot of violations for tests -->
<Rule Id="CA1829" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.Analyzers" RuleNamespace="Microsoft.CodeAnalysis.Analyzers">
......
......@@ -276,7 +276,9 @@ private void Insert(int hashCode, K key, V value, bool add)
{
if (currentNode.Left == null)
{
currentNode.Left = currentNode = new AvlNode(hashCode, key, value);
var previousNode = currentNode;
currentNode = new AvlNode(hashCode, key, value);
previousNode.Left = currentNode;
break;
}
......@@ -287,7 +289,9 @@ private void Insert(int hashCode, K key, V value, bool add)
{
if (currentNode.Right == null)
{
currentNode.Right = currentNode = new AvlNode(hashCode, key, value);
var previousNode = currentNode;
currentNode = new AvlNode(hashCode, key, value);
previousNode.Right = currentNode;
break;
}
......
......@@ -45,7 +45,7 @@ public sealed partial class ControlFlowGraph
Debug.Assert(!localFunctions.IsDefault);
Debug.Assert(localFunctionsMap != null);
Debug.Assert(localFunctionsMap.Count == localFunctions.Length);
Debug.Assert(localFunctions.Distinct().Count() == localFunctions.Length);
Debug.Assert(localFunctions.Distinct().Length == localFunctions.Length);
Debug.Assert(anonymousFunctionsMap != null);
#if DEBUG
foreach (IMethodSymbol method in localFunctions)
......
......@@ -233,7 +233,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Debug.Assert(Not arguments.IsDefault)
If argumentNames.IsDefault OrElse argumentNames.Count = 0 Then
If argumentNames.IsDefault OrElse argumentNames.Length = 0 Then
Return
End If
......@@ -242,7 +242,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End If
Dim seenName As Boolean = False
For i As Integer = 0 To argumentNames.Count - 1
For i As Integer = 0 To argumentNames.Length - 1
If argumentNames(i) IsNot Nothing Then
seenName = True
......
......@@ -223,7 +223,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim boundArrayTemp As BoundLocal = Nothing
Dim storeArray = CaptureInATemp(containingMember, node.Expression, arg, boundArrayTemp)
Dim n = node.Indices.Count
Dim n = node.Indices.Length
Dim indicesFirst(n - 1) As BoundExpression
Dim indicesSecond(n - 1) As BoundExpression
......
......@@ -1260,7 +1260,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End If
Dim targetElementTypes As ImmutableArray(Of TypeSymbol) = destination.GetElementTypesOfTupleOrCompatible()
Debug.Assert(arguments.Count = targetElementTypes.Length)
Debug.Assert(arguments.Length = targetElementTypes.Length)
' check arguments against flattened list of target element types
Dim result As ConversionKind = wideningConversion
......@@ -3576,7 +3576,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End If
Dim targetElementTypes As ImmutableArray(Of TypeSymbol) = destination.GetElementTypesOfTupleOrCompatible()
Debug.Assert(sourceElementTypes.Count = targetElementTypes.Length)
Debug.Assert(sourceElementTypes.Length = targetElementTypes.Length)
' check arguments against flattened list of target element types
Dim result As ConversionKind = ConversionKind.WideningTuple
......
......@@ -11,7 +11,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend Module CRC32
Public Function ComputeCRC32(names() As String) As UInt32
Debug.Assert(names.Count > 0)
Debug.Assert(names.Length > 0)
Dim crc32 As UInt32 = &HFFFFFFFF
For Each name In names
......
......@@ -178,7 +178,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
' Constructor. Use static Create method to create instances.
Private Sub New(containingNamespace As MergedNamespaceSymbol, namespacesToMerge As ImmutableArray(Of NamespaceSymbol))
Debug.Assert(namespacesToMerge.Distinct().Count() = namespacesToMerge.Length)
Debug.Assert(namespacesToMerge.Distinct().Length = namespacesToMerge.Length)
Me._namespacesToMerge = namespacesToMerge
Me._containingNamespace = containingNamespace
......
......@@ -251,7 +251,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
End If
Dim n = candidateReturnTypeCustomModifiers.Length
If targetReturnTypeCustomModifiers.Count <> n Then
If targetReturnTypeCustomModifiers.Length <> n Then
Return False
End If
......
......@@ -1003,7 +1003,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
For Each attr In attrs
If attr.AttributeClass Is compilation.GetWellKnownType(WellKnownType.System_ComponentModel_DesignerSerializationVisibilityAttribute) Then
Dim args = attr.CommonConstructorArguments
If args.Count = 1 Then
If args.Length = 1 Then
Dim arg = args(0)
Const DESIGNERSERIALIZATIONVISIBILITYTYPE_CONTENT As Integer = 2
If arg.Kind <> TypedConstantKind.Array AndAlso CInt(arg.Value) = DESIGNERSERIALIZATIONVISIBILITYTYPE_CONTENT Then
......
......@@ -214,7 +214,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
If node.ContainsDiagnostics Then
Dim errors = DirectCast(node, Syntax.InternalSyntax.VisualBasicSyntaxNode).GetDiagnostics
If errors IsNot Nothing Then
For i = 0 To errors.Count - 1
For i = 0 To errors.Length - 1
Dim greenError = errors(i)
Debug.Assert(greenError IsNot Nothing)
errorList.Add(CreateSyntaxError(tree, nodeOrToken, greenError))
......
......@@ -526,7 +526,7 @@ private List<XmlElementSyntax> VerifyAndPermuteParamNodes(IEnumerable<XmlElement
var reorderedParameters = updatedSignature.UpdatedConfiguration.ToListOfParameters();
var declaredParameters = declarationSymbol.GetParameters();
if (paramNodes.Count() != declaredParameters.Count())
if (paramNodes.Count() != declaredParameters.Length)
{
return null;
}
......
......@@ -144,7 +144,7 @@ private ImmutableArray<CodeAction> CreateActions(State state, CancellationToken
}
}
Debug.Assert(actions.Count() != 0, "No code actions found for MoveType Refactoring");
Debug.Assert(actions.Count != 0, "No code actions found for MoveType Refactoring");
return actions.ToImmutableArray();
}
......
......@@ -441,13 +441,13 @@ async Task<IEnumerable<Diagnostic>> ComputeDiagnosticAnalyzerDiagnosticsAsync()
var diagnostics = await analyzerDriverOpt.GetAnalyzerSyntaxDiagnosticsAsync(tree, oneAnalyzers, cancellationToken).ConfigureAwait(false);
LogSyntaxInfo(diagnostics, tree);
Debug.Assert(diagnostics.Count() == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, analyzerDriverOpt.Compilation).Count());
Debug.Assert(diagnostics.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, analyzerDriverOpt.Compilation).Count());
return diagnostics.ToImmutableArrayOrEmpty();
case AnalysisKind.Semantic:
var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
diagnostics = await analyzerDriverOpt.GetAnalyzerSemanticDiagnosticsAsync(model, spanOpt, oneAnalyzers, cancellationToken).ConfigureAwait(false);
Debug.Assert(diagnostics.Count() == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, analyzerDriverOpt.Compilation).Count());
Debug.Assert(diagnostics.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diagnostics, analyzerDriverOpt.Compilation).Count());
return diagnostics.ToImmutableArrayOrEmpty();
default:
return Contract.FailWithReturn<ImmutableArray<Diagnostic>>("shouldn't reach here");
......
......@@ -50,7 +50,7 @@ internal abstract partial class AbstractAddParameterCheckCodeRefactoringProvider
}
// Min 2 parameters to offer the refactoring
if (listOfParametersOrdinals.Count() < 2)
if (listOfParametersOrdinals.Count < 2)
{
return ImmutableArray<CodeAction>.Empty;
}
......
......@@ -174,7 +174,7 @@ internal abstract partial class AbstractNavigateToSearchService
Debug.Assert(priorityDocuments.All(d => project.ContainsDocument(d.Id)), "Priority docs included doc not from project.");
Debug.Assert(orderedDocs.Length == project.Documents.Count(), "Didn't have the same number of project after ordering them!");
Debug.Assert(orderedDocs.Distinct().Count() == orderedDocs.Count(), "Ordered list contained a duplicate!");
Debug.Assert(orderedDocs.Distinct().Length == orderedDocs.Length, "Ordered list contained a duplicate!");
Debug.Assert(project.Documents.All(d => orderedDocs.Contains(d)), "At least one document from the project was missing from the ordered list!");
foreach (var document in orderedDocs)
......
......@@ -458,7 +458,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ChangeSignature
Dim reorderedParameters = updatedSignature.UpdatedConfiguration.ToListOfParameters()
Dim declaredParameters = declarationSymbol.GetParameters()
If paramNodes.Count() <> declaredParameters.Count() Then
If paramNodes.Count() <> declaredParameters.Length Then
Return Nothing
End If
......
......@@ -360,7 +360,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.GenerateType
End If
Dim memberGroup = semanticModel.GetMemberGroup(expression, cancellationToken)
If memberGroup.Count <> 0 Then
If memberGroup.Length <> 0 Then
Return If(memberGroup.ElementAt(0).IsKind(SymbolKind.Method), DirectCast(memberGroup.ElementAt(0), IMethodSymbol), Nothing)
End If
......
......@@ -98,7 +98,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(document.ShouldHideAdvancedMembers(), semanticModel.Compilation).
Sort(symbolDisplayService, semanticModel, genericName.SpanStart)
If accessibleSymbols.Count = 0 Then
If accessibleSymbols.Length = 0 Then
Return Nothing
End If
......
......@@ -114,7 +114,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
Dim documentationCommentFormattingService = document.GetLanguageService(Of IDocumentationCommentFormattingService)()
Dim items = New List(Of SignatureHelpItem)
If memberGroup.Count > 0 Then
If memberGroup.Length > 0 Then
items.AddRange(GetMemberGroupItems(invocationExpression, semanticModel, symbolDisplayService, anonymousTypeDisplayService, documentationCommentFormattingService, within, memberGroup, cancellationToken))
End If
......
......@@ -64,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseObjectInitializer
Dim match = matches(i)
Dim rightValue = match.Initializer
If i < matches.Count - 1 Then
If i < matches.Length - 1 Then
rightValue = rightValue.WithoutTrailingTrivia()
End If
......
......@@ -70,7 +70,7 @@ Friend Class GrammarGenerator
Return childKinds IsNot Nothing AndAlso childKinds.Count = structureNode.NodeKinds.Count
End Function).ToArray()
If correspondingChildren.Count > 0 Then
If correspondingChildren.Length > 0 Then
compoundNodes.Add(structureNode)
Dim correspondingChildrenKinds = correspondingChildren.ToDictionary(
......
......@@ -107,7 +107,7 @@ private static async Task<int> RunCore(Options options, CancellationToken cancel
ConsoleUtil.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}");
ConsoleUtil.WriteLine($"Proc dump location: {options.ProcDumpDirectory}");
ConsoleUtil.WriteLine($"Running {options.Assemblies.Count()} test assemblies in {assemblyInfoList.Count} partitions");
ConsoleUtil.WriteLine($"Running {options.Assemblies.Count} test assemblies in {assemblyInfoList.Count} partitions");
var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true);
var elapsed = DateTime.Now - start;
......
......@@ -115,7 +115,7 @@ internal string GetDefaultFixAllTitle()
{
var diagnosticIds = this.DiagnosticIds;
string diagnosticId;
if (diagnosticIds.Count() == 1)
if (diagnosticIds.Count == 1)
{
diagnosticId = diagnosticIds.Single();
}
......
......@@ -328,11 +328,11 @@ private static void AddConflictingSymbolLocations(IEnumerable<ISymbol> conflicti
var location = await GetSymbolLocationAsync(solution, symbol, cancellationToken).ConfigureAwait(false);
if (location != null && location.IsInSource)
{
renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(solution.GetDocumentId(location.SourceTree), location.SourceSpan, overriddenFromMetadata, locations.Count());
renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(solution.GetDocumentId(location.SourceTree), location.SourceSpan, overriddenFromMetadata, locations.Length);
}
else
{
renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(GetString(symbol), locations.Count());
renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(GetString(symbol), locations.Length);
}
symbolIndex++;
......
......@@ -27,7 +27,7 @@ public static ImmutableArray<Location> GetMembersWithConflictingSignatures(IProp
var potentiallyConfictingProperties =
renamedProperty.ContainingType.GetMembers(renamedProperty.Name)
.OfType<IPropertySymbol>()
.Where(m => !m.Equals(renamedProperty) && m.Parameters.Count() == renamedProperty.Parameters.Count());
.Where(m => !m.Equals(renamedProperty) && m.Parameters.Length == renamedProperty.Parameters.Length);
return GetConflictLocations(renamedProperty, potentiallyConfictingProperties, isMethod: false,
(property) => GetAllSignatures((property as IPropertySymbol).Parameters, trimOptionalParameters));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册