Skip to content

Conversation

@adityapatwardhan
Copy link
Member

@adityapatwardhan adityapatwardhan commented Jul 7, 2021

PR Summary

Fix CA1846 and CA1845 violations by replacing Substring with AsSpan.

PR Context

These violations cause build break when used with .NET 6 Preview 6.

PR Checklist

@ghost ghost assigned iSazonov Jul 7, 2021
@adityapatwardhan adityapatwardhan added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Jul 7, 2021
Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

Look good other than what Steve already pointed out.

@iSazonov
Copy link
Collaborator

iSazonov commented Jul 8, 2021

I think it makes sense to add the rules in .globalconfig.

adityapatwardhan and others added 2 commits July 9, 2021 10:24
…letionCompleters.cs

Co-authored-by: Steve Lee <slee@microsoft.com>
Co-authored-by: Steve Lee <slee@microsoft.com>
@adityapatwardhan
Copy link
Member Author

@iSazonov they are already there:

PowerShell/.globalconfig

Lines 473 to 479 in c49cf06

# CA1845: Use span-based 'string.Concat'
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845
dotnet_diagnostic.CA1845.severity = warning
# CA1846: Prefer 'AsSpan' over 'Substring'
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1846
dotnet_diagnostic.CA1846.severity = warning

@adityapatwardhan adityapatwardhan merged commit 6d09c6e into PowerShell:master Jul 9, 2021
@adityapatwardhan adityapatwardhan deleted the FixNet6p6Issues branch July 9, 2021 17:55
@iSazonov iSazonov added this to the 7.2.0-preview.8 milestone Jul 12, 2021
@ghost
Copy link

ghost commented Jul 22, 2021

🎉v7.2.0-preview.8 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants