-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Enable CA1507: Use nameof to express symbol names #13875
Conversation
src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs
Outdated
Show resolved
Hide resolved
@@ -185,7 +185,7 @@ private bool FilterMatch(ManagementObject obj) | |||
foreach (string desc in Description) | |||
{ | |||
WildcardPattern wildcardpattern = WildcardPattern.Get(desc, WildcardOptions.IgnoreCase); | |||
if (wildcardpattern.IsMatch((string)obj["Description"])) | |||
if (wildcardpattern.IsMatch((string)obj[nameof(Description)])) |
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.
Here Description is a property name of ManagementObject.
Or can it be:
if (wildcardpattern.IsMatch((string)obj[nameof(Description)])) | |
if (wildcardpattern.IsMatch((string)obj[nameof(obj.Description)])) |
Also what about "InstalledBy" in the file?
I suggest to revert such non-obvious changes here and below because we can break something tricky.
@@ -89,55 +89,55 @@ internal bool HasHostWindow | |||
{ | |||
get | |||
{ | |||
return (bool)_graphicalHostReflectionWrapper.GetPropertyValue("HasHostWindow"); | |||
return (bool)_graphicalHostReflectionWrapper.GetPropertyValue(nameof(HasHostWindow)); |
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.
The same. HasHostWindow is a property of GraphicalHostReflectionWrapper.
I see the same patterns below.
RemotingEncoder.AddNoteProperty<object>(dest, "TargetObject", delegate () { return TargetObject; }); | ||
RemotingEncoder.AddNoteProperty<string>(dest, "FullyQualifiedErrorId", delegate () { return FullyQualifiedErrorId; }); | ||
RemotingEncoder.AddNoteProperty<InvocationInfo>(dest, "InvocationInfo", delegate () { return InvocationInfo; }); | ||
RemotingEncoder.AddNoteProperty<Exception>(dest, nameof(Exception), delegate () { return Exception; }); |
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.
Again, is the reference to Exception right?
Below in the file too.
informationRecord.ProcessId = RemotingDecoder.GetPropertyValue<uint>(inputObject, "ProcessId"); | ||
informationRecord.NativeThreadId = RemotingDecoder.GetPropertyValue<uint>(inputObject, "NativeThreadId"); | ||
informationRecord.ManagedThreadId = RemotingDecoder.GetPropertyValue<uint>(inputObject, "ManagedThreadId"); | ||
informationRecord.User = RemotingDecoder.GetPropertyValue<string>(inputObject, nameof(User)); |
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.
The same.
@xtqqczze Please address my comments. |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@xtqqczze Can we continue? If there are doubts please revert and suppress locally. |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507
Follow-up #12716