maui
maui copied to clipboard
Avoid zero-length array allocations
Description of Change
Noticed while looking at another issue that CA1825 is configured as an error in .editorconfig, but there are various violations. Pretty minor, but looks like it saves a reasonable number of allocations in some bindings scenarios at least. Thought the blanket fix-all should be reasonable since it should be a non-breaking change.
Hey there @molesmoke! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.
Maybe the CA1825 warning should be treated as an error
Does this get rid of all the warnings? If yes, I would indeed say treat this as an error from now on? @hartez?
@jfversluis Yup, this fixes all occurrences - or at least all that I'm aware of :). At the moment its enforcement is limited to Core, but seems reasonable to me that it should be solution-wide.
@jfversluis Seems like I did miss a few 😅 The iOS ones needed a bit of manual effort to fix up
/azp run MAUI-UITests-public
Azure Pipelines successfully started running 1 pipeline(s).
/rebase
Does this get rid of all the warnings? If yes, I would indeed say treat this as an error from now on? @hartez?
@jfversluis Yup, this fixes all occurrences - or at least all that I'm aware of :). At the moment its enforcement is limited to Core, but seems reasonable to me that it should be solution-wide.
We should enforce this in all of the projects eventually (we already do in Core). But if we're going to PR a change to fix all the rule violations in a project, we also need to turn on enforcement of the rule for that project (so no new violations creep in).
So at the very least, this PR needs to add editorconfig changes to enforce CA1825 for each other project. I would prefer we do these one project per PR (it makes for a much easier review), but I'd consider taking this if the editorconfig entries were there.
@hartez The PR already moves dotnet_diagnostic.CA1825.severity = error
to the root editor config:
https://github.com/dotnet/maui/pull/19300/commits/aa84d7c7e5d2937f3ec371cabb40656e10fed8b3
I put it in a separate commit in case the enforcement wasn't wanted (easier to cherry-pick/revert etc.), but I could squash it if you want? I'll rebase in the meantime...
/azp run MAUI-UITests-public
Azure Pipelines successfully started running 1 pipeline(s).
🤣🤦🏽♂️
Get Outlook for iOShttps://aka.ms/o0ukef
From: azure-pipelines[bot] @.> Sent: Friday, January 12, 2024 9:11:02 PM To: dotnet/maui @.> Cc: Subscribed @.***> Subject: Re: [dotnet/maui] Avoid zero-length array allocations (PR #19300)
Azure Pipelines successfully started running 1 pipeline(s).
— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/maui/pull/19300#issuecomment-1889015365, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AECNY5S7NSDHL6OOMRSZKK3YOER5NAVCNFSM6AAAAABALXP7L2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBZGAYTKMZWGU. You are receiving this because you are subscribed to this thread.Message ID: @.***>
@hartez The PR already moves
dotnet_diagnostic.CA1825.severity = error
to the root editor config:
Sorry, my bad. Somehow I missed that you'd put it at the root.