Skip to content

Commit

Permalink
[main] Update dependencies from dotnet/roslyn-analyzers (#87768)
Browse files Browse the repository at this point in the history
* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230618.1

* Suppress RS1038 analyzer

* Fix new failures found with CA1859 analyzer updates

* Disable CA2261 on test projects, fix more CA1859 findings

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Buyaa Namnan <[email protected]>
  • Loading branch information
3 people authored Jul 10, 2023
1 parent e40d6e1 commit 54cb573
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 16 deletions.
3 changes: 3 additions & 0 deletions eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ dotnet_diagnostic.CA2259.severity = warning
# CA2260: Use correct type parameter
dotnet_diagnostic.CA2260.severity = warning

# CA2261: Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
dotnet_diagnostic.CA2261.severity = warning

# CA2300: Do not use insecure deserializer BinaryFormatter
dotnet_diagnostic.CA2300.severity = none

Expand Down
3 changes: 3 additions & 0 deletions eng/CodeAnalysis.test.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ dotnet_diagnostic.CA2259.severity = none
# CA2260: Use correct type parameter
dotnet_diagnostic.CA2260.severity = none

# CA2261: Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
dotnet_diagnostic.CA2261.severity = none

# CA2300: Do not use insecure deserializer BinaryFormatter
dotnet_diagnostic.CA2300.severity = none

Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,13 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>7787409c6b529c021d4f8b5fbe3d620094953be9</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.3.5-beta1.23308.2">
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.23357.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>2f0301ef59624a72fb00f7fd92caa50be03f277d</Sha>
<Sha>82603c16509d7383cd1922680773a79b839b1705</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23308.2">
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23357.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>2f0301ef59624a72fb00f7fd92caa50be03f277d</Sha>
<Sha>82603c16509d7383cd1922680773a79b839b1705</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100-preview.7.23329.3">
<Uri>https://github.com/dotnet/sdk</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</ItemGroup>
<PropertyGroup>
<!-- dotnet/roslyn-analyzers dependencies -->
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.5-beta1.23308.2</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23308.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>3.11.0-beta1.23357.1</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23357.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<!-- dotnet/roslyn dependencies -->
<!--
These versions should not be used by any project that contributes to the design-time experience in VS, such as an analyzer, code-fix, or generator assembly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ internal Delegate CreateDelegateNoThrowOnBindFailure(RuntimeTypeInfo runtimeDele
return null;
}

#pragma warning disable CA1859 // Use concrete types when possible for improved performance https://github.com/dotnet/roslyn-analyzers/issues/6751
IList<ParameterInfo> delegateParameters = invokeMethod.GetParametersNoCopy();
IList<ParameterInfo> targetParameters = this.GetParametersNoCopy();
#pragma warning restore CA1859
IEnumerator<ParameterInfo> delegateParameterEnumerator = delegateParameters.GetEnumerator();
IEnumerator<ParameterInfo> targetParameterEnumerator = targetParameters.GetEnumerator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public IEnumerable<P> ComputeVerticesInvolvedInAFlaggedCycle()
}
#endif

return verticesInAFlaggedCycleTarjanStyle.Select(v => v.Payload).ToArray();
return verticesInAFlaggedCycleTarjanStyle.Select(v => v.Payload);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public EagerlyBuiltVTableSliceNode(TypeDesc type)
{
}

private static IReadOnlyList<MethodDesc> ComputeSlots(TypeDesc type)
private static MethodDesc[] ComputeSlots(TypeDesc type)
{
var slots = default(ArrayBuilder<MethodDesc>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private static ExceptionInfo GetExceptionInfo(Exception? exception)
/// <summary>
/// Converts an ILogger state object into a set of key-value pairs (That can be send to a EventSource)
/// </summary>
private static IReadOnlyList<KeyValuePair<string, string?>> GetProperties(object? state)
private static KeyValuePair<string, string?>[] GetProperties(object? state)
{
if (state is IReadOnlyList<KeyValuePair<string, object?>> keyValuePairs)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static partial class Enumerable
{
public static IEnumerable<TResult> Empty<TResult>() => Array.Empty<TResult>();

private static IEnumerable<TResult>? GetEmptyIfEmpty<TSource, TResult>(IEnumerable<TSource> source) =>
private static TResult[]? GetEmptyIfEmpty<TSource, TResult>(IEnumerable<TSource> source) =>
source is TSource[] { Length: 0 } ?
Array.Empty<TResult>() :
null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected override void InitIDs()
}

[RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)]
private object GenerateMembersElement(XmlMembersMapping xmlMembersMapping)
private object?[] GenerateMembersElement(XmlMembersMapping xmlMembersMapping)
{
if (xmlMembersMapping.Accessor.IsSoap)
{
Expand All @@ -102,7 +102,7 @@ private object GenerateMembersElement(XmlMembersMapping xmlMembersMapping)
}

[RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)]
private object GenerateLiteralMembersElement(XmlMembersMapping xmlMembersMapping)
private object[] GenerateLiteralMembersElement(XmlMembersMapping xmlMembersMapping)
{
ElementAccessor element = xmlMembersMapping.Accessor;
MemberMapping[] mappings = ((MembersMapping)element.Mapping!).Members!;
Expand Down Expand Up @@ -322,7 +322,7 @@ private static void InitializeValueTypes(object?[] p, MemberMapping[] mappings)
}

[RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)]
private object GenerateEncodedMembersElement(XmlMembersMapping xmlMembersMapping)
private object?[] GenerateEncodedMembersElement(XmlMembersMapping xmlMembersMapping)
{
ElementAccessor element = xmlMembersMapping.Accessor;
var membersMapping = (MembersMapping)element.Mapping!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<IsRoslynComponent>true</IsRoslynComponent>
<!-- Disable RS2008: Enable analyzer release tracking
Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) -->
<NoWarn>RS2008;$(NoWarn)</NoWarn>
<NoWarn>RS2008;RS1038;$(NoWarn)</NoWarn>
<DefineConstants>$(DefineConstants);JSIMPORTGENERATOR</DefineConstants>
<AnalyzerLanguage>cs</AnalyzerLanguage>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<IsRoslynComponent>true</IsRoslynComponent>
<!-- Disable RS2008: Enable analyzer release tracking
Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) -->
<NoWarn>RS2008;$(NoWarn)</NoWarn>
<NoWarn>RS2008;RS1038;$(NoWarn)</NoWarn>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<DefineConstants>$(DefineConstants);MICROSOFT_INTEROP_COMINTERFACEGENERATOR</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<IsRoslynComponent>true</IsRoslynComponent>
<!-- Disable RS2008: Enable analyzer release tracking
Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) -->
<NoWarn>RS2008;$(NoWarn)</NoWarn>
<NoWarn>RS2008;RS1038;$(NoWarn)</NoWarn>
<AnalyzerLanguage>cs</AnalyzerLanguage>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ private static RecipientInfoCollection CreateRecipientInfos(SafeCryptMsgHandle h
return new RecipientInfoCollection(recipientInfos);
}

#pragma warning disable CA1859 // Use concrete types when possible for improved performance https://github.com/dotnet/roslyn-analyzers/issues/6751
private static IEnumerable<RecipientInfo> ToRecipientInfosForThisIndex(SafeHandle pCmsgCmsRecipientInfoMemory, int index)
#pragma warning restore CA1859
{
bool mustRelease = false;
pCmsgCmsRecipientInfoMemory.DangerousAddRef(ref mustRelease);
Expand Down

0 comments on commit 54cb573

Please sign in to comment.