Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Enable IDE0049: PreferBuiltInOrFrameworkType#14491

Merged
adityapatwardhan merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
xtqqczze:IDE0049xtqqczze/PowerShell-PowerShell:IDE0049Copy head branch name to clipboard
Jul 28, 2021
Merged

Enable IDE0049: PreferBuiltInOrFrameworkType#14491
adityapatwardhan merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
xtqqczze:IDE0049xtqqczze/PowerShell-PowerShell:IDE0049Copy head branch name to clipboard

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Dec 23, 2020

Copy link
Copy Markdown
Contributor

cc: @iSazonov

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0049

Skipped:
src\Microsoft.PowerShell.Commands.Diagnostics\CounterSample.cs
src\Microsoft.PowerShell.Commands.Diagnostics\GetCounterCommand.cs
src\Microsoft.PowerShell.Commands.Diagnostics\PdhHelper.cs

@xtqqczze xtqqczze marked this pull request as ready for review December 23, 2020 22:26
@iSazonov

iSazonov commented Dec 24, 2020

Copy link
Copy Markdown
Collaborator

I doubt it is necessary. These CIM, WSMan, Counter codes are specific and frozen. All other places have already been corrected earlier. I think we should only set the severity to suggestion.

@ghost ghost added the Review - Needed The PR is being reviewed label Dec 31, 2020
@ghost

ghost commented Dec 31, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@adityapatwardhan

Copy link
Copy Markdown
Member

@xtqqczze Please resolve merge conflicts

@ghost ghost removed the Review - Needed The PR is being reviewed label Apr 16, 2021
@ghost ghost added the Review - Needed The PR is being reviewed label Apr 24, 2021
@ghost

ghost commented Apr 24, 2021

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@anmenaga

Copy link
Copy Markdown

Maintainer review summary: ok to take this considering that this does not touch files that are frequently changed therefore the chance of introducing merge conflicts is low. Additionally, files that are not part of the build should be removed from this PR (@adityapatwardhan to give list of such files).

@ghost ghost removed the Review - Needed The PR is being reviewed label Apr 27, 2021
@adityapatwardhan

Copy link
Copy Markdown
Member

The files that are not compiled and hence should be removed from PR. Files to be removed:

PdhHelper.cs
CounterSample.cs
GetCounterCommand.cs

@ghost ghost added the Review - Needed The PR is being reviewed label May 5, 2021
@ghost

ghost commented May 5, 2021

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@xtqqczze

xtqqczze commented May 8, 2021

Copy link
Copy Markdown
Contributor Author

In dotnet/roslyn, the IDE0049 rule is specified as EnforceOnBuild.Never therefore we cannot enforce the rule during build, see:
dotnet/roslyn#50173
https://github.com/dotnet/roslyn/blob/9c10b941e96760e0c986c8f2afb0d5b4c34e67e3/src/Analyzers/Core/Analyzers/EnforceOnBuildValues.cs#L105

There is still value in enabling the rule, as it will be used for live analysis in the IDE.

GitHub
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs. - dotnet/roslyn

@xtqqczze

Copy link
Copy Markdown
Contributor Author

@adityapatwardhan The suggested changes have been made, please could you continue your review.

Comment thread src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs Outdated
@xtqqczze

Copy link
Copy Markdown
Contributor Author

rebased

@rkeithhill rkeithhill left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I like the consistency even though it is a lot of code change.

@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Jun 28, 2021
@adityapatwardhan adityapatwardhan merged commit 0f2f23f into PowerShell:master Jul 28, 2021
@ghost ghost removed the Review - Needed The PR is being reviewed label Jul 28, 2021
@adityapatwardhan

Copy link
Copy Markdown
Member

@xtqqczze Thank you for your contribution!

@xtqqczze

Copy link
Copy Markdown
Contributor Author

Contributes to #25922.

xtqqczze added a commit to xtqqczze/PowerShell-PowerShell that referenced this pull request Sep 25, 2025
Temporarily disable this rule until all violations are addressed.

Not all rule violations were resolved in PowerShell#14491. Since the rulehas internal setting `EnforceOnBuild.Never` it doesn’t affect builds, however it still produces distracting warnings during design-time analysis.

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0049
xtqqczze added a commit to xtqqczze/PowerShell-PowerShell that referenced this pull request Oct 9, 2025
Temporarily disable this rule until all violations are addressed.

Not all rule violations were resolved in PowerShell#14491. Since the rulehas internal setting `EnforceOnBuild.Never` it doesn’t affect builds, however it still produces distracting warnings during design-time analysis.

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0049
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.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.