GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Enable IDE0044: MakeFieldReadonly by xtqqczze · Pull Request #13880 · PowerShell/PowerShell

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Oct 26, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Enable IDE0044: MakeFieldReadonly as warning.

  • Add suppression for ComInterop via GlobalSuppressions.cs
  • Convert a few static readonly fields to const.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost ghost assigned Andrew (anmenaga) Oct 26, 2020
@xtqqczze xtqqczze mentioned this pull request Oct 26, 2020
Enable Roslyn analyzers in build process #11916
Closed
7 of 14 tasks
@xtqqczze
xtqqczze force-pushed the IDE0044 branch from d927897 to bd574d5 Compare October 26, 2020 16:19
This was referenced Oct 26, 2020
Fix IDE0044: MakeFieldReadonly part 1 #13884
Merged
Fix IDE0044: MakeFieldReadonly part 2 #13885
Merged
Fix IDE0044: MakeFieldReadonly part 3 #13886
Merged
Fix IDE0044: MakeFieldReadonly part 4 #13887
Merged
Fix IDE0044: MakeFieldReadonly part 5 #13888
Merged
Fix IDE0044: MakeFieldReadonly part 6 #13889
Merged
Fix IDE0044: MakeFieldReadonly part 7 #13890
Merged
Fix IDE0044: MakeFieldReadonly part 8 #13891
Merged
Fix IDE0044: MakeFieldReadonly part 9 #13892
Merged
Fix IDE0044: MakeFieldReadonly part 10 #13893
Merged
@xtqqczze
xtqqczze marked this pull request as ready for review October 27, 2020 20:49
@xtqqczze
xtqqczze requested review from Steve Lee (SteveL-MSFT), Travis Plunk (TravisEz13), Aditya Patwardhan (adityapatwardhan), Andrew (anmenaga) and Dongbo Wang (daxian-dbw) as code owners October 27, 2020 20:49
@iSazonov

Ilya (iSazonov) commented Nov 2, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

xtqqczze Please resolve merge conflicts and rebase.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze xtqqczze changed the title Enable IDE0044: MakeFieldReadonly Enable IDE0044: MakeFieldReadonly part 11 Nov 2, 2020
@xtqqczze
xtqqczze force-pushed the IDE0044 branch from bd574d5 to efd5e63 Compare November 2, 2020 10:44
@xtqqczze

xtqqczze commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) We can reuse this PR for src\Microsoft.Management.Automation changes?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Nov 2, 2020

Copy link
Copy Markdown
Collaborator

The PR is still huge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze xtqqczze changed the title Enable IDE0044: MakeFieldReadonly part 11 Enable IDE0044: MakeFieldReadonly Nov 2, 2020
This was referenced Nov 2, 2020
Fix IDE0044: MakeFieldReadonly part 11 #13966
Merged
Fix IDE0044: MakeFieldReadonly part 12 #13967
Merged
Fix IDE0044: MakeFieldReadonly part 13 #13968
Merged
Fix IDE0044: MakeFieldReadonly part 14 #13969
Merged
Fix IDE0044: MakeFieldReadonly part 15 #13970
Merged
@iSazonov

Ilya (iSazonov) commented Jun 28, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

xtqqczze Please look the code in .Net Runtime repository. Perhaps they already fixed the issues. If no we could suppress the warnings on file level:

[ExcepInfo.cs]
dotnet_diagnostic.IDE0044.severity = none

(For generated code https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#exclude-generated-code)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost removed the Review - Needed The PR is being reviewed label Jun 28, 2021
PaulHigin
Paul Higinbotham (PaulHigin) suggested changes Jun 28, 2021
View reviewed changes
Comment thread src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/security/CatalogHelper.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/security/CatalogHelper.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/security/CatalogHelper.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/security/CatalogHelper.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/security/nativeMethods.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Jun 28, 2021
xtqqczze and others added 5 commits June 29, 2021 01:28
@xtqqczze @PaulHigin
Apply suggestions from code review
94576a5
Co-authored-by: Paul Higinbotham <[email protected]>
@xtqqczze
Revert and suppress
e45adb0
@xtqqczze
Add Github issue link
e616c49
@xtqqczze
Suppress IDE0044 for System.Management.Automation.ComInterop
57aae3d
@xtqqczze
Fix CA1805
c65645f
requested by @PaulHigin
@xtqqczze

xtqqczze commented Jun 29, 2021

Copy link
Copy Markdown
Contributor Author

/home/vsts/work/1/s/src/System.Management.Automation/engine/interpreter/InstructionList.cs(99,49): error CS0649: Field 'InstructionList._debugCookies' is never assigned to, and will always have its default value null [/home/vsts/work/1/s/src/System.Management.Automation/System.Management.Automation.csproj]

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze
Fix CS0649
1a0c328
@iSazonov

Ilya (iSazonov) commented Jun 29, 2021 •
edited by unfurl-links Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

xtqqczze Please look the code in .Net Runtime repository. Perhaps they already fixed the issues. If no we could suppress the warnings on file level:

[ExcepInfo.cs]
dotnet_diagnostic.IDE0044.severity = none

(For generated code https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#exclude-generated-code)

Doesn't this work?

Configure code analysis rules - .NET
Learn how to configure code analysis rules in an analyzer configuration file.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Jun 30, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

xtqqczze Please look the code in .Net Runtime repository. Perhaps they already fixed the issues. If no we could suppress the warnings on file level:

[ExcepInfo.cs]
dotnet_diagnostic.IDE0044.severity = none

(For generated code https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#exclude-generated-code)

Doesn't this work?

Ilya (@iSazonov) Unless I specify the absolute path, I see warning InvalidGlobalSectionName, so probably this approach doesn't work in a GlobalConfig file. In any case, suppression in a GlobalSuppressions.cs file works for this PR. Ideally, the ComInterop code would be split to separate project and we set RunAnalyzers to false in the csproj. We could open an issue to discuss the best approach.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Jul 1, 2021

Copy link
Copy Markdown
Contributor Author

Depends on #15704.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Jul 1, 2021

Copy link
Copy Markdown
Collaborator

Ilya (@iSazonov) Unless I specify the absolute path, I see warning InvalidGlobalSectionName, so probably this approach doesn't work in a GlobalConfig file. In any case, suppression in a GlobalSuppressions.cs file works for this PR. Ideally, the ComInterop code would be split to separate project and we set RunAnalyzers to false in the csproj. We could open an issue to discuss the best approach.

absolute path? What about relative?

I don't like the assembly level suppression and I'd consider it as only last resort.

I believe we don't want ComInterop in separate project because we don't want new additional dll.

PaulHigin reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Jul 3, 2021

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) Unless I specify the absolute path, I see warning InvalidGlobalSectionName, so probably this approach doesn't work in a GlobalConfig file. In any case, suppression in a GlobalSuppressions.cs file works for this PR. Ideally, the ComInterop code would be split to separate project and we set RunAnalyzers to false in the csproj. We could open an issue to discuss the best approach.

absolute path? What about relative?

I don't like the assembly level suppression and I'd consider it as only last resort.

It seems that section headers for global AnalyzerConfig files must specify an absolute file path. A relative file path produces a compiler warning and is ignored.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Prosper-web
Prosper-web approved these changes Jul 3, 2021
View reviewed changes

@Prosper-web Prosper-web left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iSazonov
Ilya (iSazonov) approved these changes Jul 4, 2021
View reviewed changes
@iSazonov Ilya (iSazonov) added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Jul 4, 2021
PaulHigin
Paul Higinbotham (PaulHigin) approved these changes Jul 6, 2021
View reviewed changes
@iSazonov
Ilya (iSazonov) merged commit 03b07a0 into PowerShell:master Jul 7, 2021
@iSazonov Ilya (iSazonov) assigned Ilya (iSazonov) and unassigned Andrew (anmenaga) Jul 7, 2021
@iSazonov Ilya (iSazonov) added this to the 7.2.0-preview.8 milestone Jul 7, 2021
@xtqqczze xtqqczze mentioned this pull request Jul 7, 2021
Fix HyperVSocketEndPoint.ServiceId setter #15704
Merged
@xtqqczze
xtqqczze deleted the IDE0044 branch July 7, 2021 06:36
@ghost

Deleted user (ghost) commented Jul 22, 2021

Copy link
Copy Markdown

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

Handy links:

  • Release Notes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze xtqqczze mentioned this pull request Sep 27, 2022
Remove PathSearchTrimEnd #18166
Closed
8 of 22 tasks
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@xtqqczze
Enable IDE0044: MakeFieldReadonly (PowerShell#13880)
eebb236
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov approved these changes
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw daxian-dbw is a code owner
@SteveL-MSFT Steve Lee (SteveL-MSFT) Awaiting requested review from SteveL-MSFT
@TravisEz13 Travis Plunk (TravisEz13) Awaiting requested review from TravisEz13 TravisEz13 is a code owner
+2 more reviewers
@PaulHigin Paul Higinbotham (PaulHigin) PaulHigin approved these changes
@Prosper-web Prosper-web Prosper-web approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

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

Projects

None yet

Milestone

7.2.0-preview.8

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@xtqqczze @iSazonov @PaulHigin @Prosper-web @anmenaga
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.