-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[ColorPicker] Enable analyzer and fix warnings #16543
[ColorPicker] Enable analyzer and fix warnings #16543
Conversation
@check-spelling-bot Report🔴 Please reviewSee the files view or the action log for details. Unrecognized words (1)postives Previously acknowledged words that are now absentabap abcd abcdefgh appcontainer atop autogenerates AZCLI azurecr binskim bios Bools btm buildcommand buildtools cameligo CCB cdpxwin cdxml CEBB CFFDAFADA ChaseKnowlden cjs CleanCodeDeveloper cljs CPPARM CPPx crutkas csx CTLCOLORSTATIC defaultcommand Deuchert dupenv DUSTIN efgh errc errorlevel estdir etcore Firefox FIXME fsscript Gamebar graphql Grayscale gsuberland hmon iccex ICONINFORMATION IMonitor INITCOMMONCONTROLSEX INSTALLLOGATTRIBUTES INSTALLLOGMODE INSTALLUILEVEL Javascript julia Knowlden kotlin ktm kts LASTEXITCODE LEQ ligo linkid litcoffee MAINICON MAKELPARAM Minimizeallwindows mkdir moderncop modulekey msiexec MSIINSTALLER MSIL namings NATIVEFNTCTL neq netlify nocache php phps plx policheck popd powerquery psc psm Pui pushd pyc pyd pyi pyo pyz Qin rda rdata rdeveen rds reportbug rexit robocopy scm SETRANGE SETSTEP SHAREIMAGELISTS sizeg smallbasic spamming spdth sregex STEPIT stx svh SWITCHEND symlink symlinks systemverilog taskkill tbc tcl timezone tlbimp trackpad typeparamref UITo umd uninit UWPUI vbhtml verilog vse vsix WDK wdksetup wdkvsix We'd webclient webpack wifstream WINMSAPP WTLTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the git@github.com:CleanCodeDeveloper/PowerToys.git repository
If the flagged items do not appear to be textIf items relate to a ...
|
I'm not sure what to do with CA1838: Avoid StringBuilder parameters for P/Invokes from the docs:
I decided to suppress it for now. |
86221ba
to
c831e2f
Compare
Renaming everything would be a lot of work. It does not do any harm if an EventHandler delegate ends with the suffix EventHandler. Besides this, the Rule causes some false postives
c831e2f
to
a534913
Compare
We are not concerned about the performance impact of marshaling a StringBuilder
for stuff supressed, lets create dedicated issues to unsupress |
Sure can do. An alternative approach would be to have a look at the whole |
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.
Just a nit. Other than that, LGTM!
@@ -39,7 +39,7 @@ public static void Main(string[] args) | |||
|
|||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) | |||
{ | |||
Logger.LogError("Unhandled exception", (e.ExceptionObject is Exception) ? (e.ExceptionObject as Exception) : new 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.
The logic is changed. Perhaps this needs to be unrolled into an if else
block instead, but we should keep logic here.
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.
new Exception()
raises the warning CA2201: Do not raise reserved exception types.
My though process was that the UnhandledExceptionEventArgs.ExceptionObject
will always be of type exception or null. If it is of type exception the code behaves the same.
In the unexpected case that UnhandledExceptionEventArgs.ExceptionObject
is not based on Exception
or null
I changed the code to pass null
instead of new Exception()
into the LogError(...)
Method.
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.
What do you think about:
if (e.ExceptionObject is Exception ex)
{
Logger.LogError("Unhandled exception", ex);
}
else
{
Logger.LogError("Unhandled exception");
}
instead of
Logger.LogError("Unhandled exception", e.ExceptionObject as 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.
Sounds good to me, actually. Just verified LogError has that alternative signature. No idea why it wasn't used here in the first place 🤷 .
Thank you 😄
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.
LGTM! Thank you for the contribution.
Summary of the Pull Request
What is this about:
What is included in the PR:
How does someone test / validate:
Quality Checklist
Contributor License Agreement (CLA)
A CLA must be signed. If not, go over here and sign the CLA.