Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,4 @@
</PropertyGroup>

<Import Project="..\Directory.Build.props" />

<!--
These packages affect the design-time experience in VS, we update them
at the same cadance as the MicrosoftCodeAnalysisVersion_LatestVS version.
This property is set eng/Versions.props but we override it because the current
version 4.7.0 flags several warnings that need area-owner expertise to resolve.
TODO: https://github.com/dotnet/runtime/issues/91030.
-->
<PropertyGroup>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>4.5.0</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<AnalyzerLanguage>cs</AnalyzerLanguage>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(CoreLibSharedDir)System/Index.cs" />
</ItemGroup>

<ItemGroup>
<!-- The repo CodeAnalyis version is ahead of what is shipped with Visual Studio, so that version breaks the analyzers when used in .Net Framework builds -->
<!-- Once Visual Studio ships with a version >= $(MicrosoftCodeAnalysisVersion), this should be changed to use the property -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected override bool ReportSpecialIncompatibleMembersDiagnostic (OperationAna
}

protected override bool VerifyAttributeArguments (AttributeData attribute) => attribute.ConstructorArguments.Length == 0 ||
attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments[0] is { Type.SpecialType: SpecialType.System_String } ctorArg;
attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..];

protected override string GetMessageFromAttribute (AttributeData requiresAttribute)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected override bool IsAnalyzerEnabled (AnalyzerOptions options, Compilation
options.IsMSBuildPropertyValueTrue (MSBuildPropertyOptionNames.EnableAotAnalyzer, compilation);

protected override bool VerifyAttributeArguments (AttributeData attribute) =>
attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments[0] is { Type.SpecialType: SpecialType.System_String } ctorArg;
attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..];

protected override string GetMessageFromAttribute (AttributeData? requiresAttribute)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static bool IsInRequiresUnreferencedCodeAttributeScope (this ISymbol memb
/// <param name="attribute">Attribute data to compare.</param>
/// <returns>True if the validation was successfull; otherwise, returns false.</returns>
public static bool VerifyRequiresUnreferencedCodeAttributeArguments (AttributeData attribute)
=> attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments[0] is { Type.SpecialType: SpecialType.System_String } ctorArg;
=> attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments is [ { Type.SpecialType: SpecialType.System_String }, ..];

public static string GetMessageFromAttribute (AttributeData? requiresAttribute)
{
Expand Down