-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Adding more MessageBox buttons and result values #10720
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
Adding more MessageBox buttons and result values #10720
Conversation
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Why is there so much whitespace changes involved? This should be trivial to review but these changes make it unnecessarily complicated. |
It might be some settings in Visual Studio that causes this. I will see if I can revert the white space changes. |
Or at least have them in a separate commit if intentional. I cannot easily tell whether src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs contains any changes or not. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10720 +/- ##
===================================================
+ Coverage 11.23215% 13.16493% +1.93277%
===================================================
Files 3314 3317 +3
Lines 665180 665389 +209
Branches 74668 74672 +4
===================================================
+ Hits 74714 87598 +12884
+ Misses 589167 575312 -13855
- Partials 1299 2479 +1180
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Learning WPF project development by pressing auto format the hard way. 😀 |
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/MessageBox.cs
Outdated
Show resolved
Hide resolved
I fixed many of the white space changes, but it seems I have a setting that trims white spaces on line endings. That account for most of the changes remaining. |
@bstordrup Having tests would be a nice addition indeed! As for the whitespaces, yeah funny enough there's always a whitespace before the |
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.
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/PresentationFramework.Tests.csproj: Language not supported
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs:982
- Verify that the enum ordering and assigned values in the cycle-breakers file are consistent with the primary definitions to avoid potential mapping inconsistencies.
AbortRetryIgnore = 2,
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/MessageBox.cs
Show resolved
Hide resolved
@h3xds1nz, Added tests for exceptional paths of |
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
Using WpfTheory and MemberData for similar tests
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.
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/PresentationFramework.Tests.csproj: Language not supported
Comments suppressed due to low confidence (2)
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/MessageBox.cs:89
- The default case in Win32ToMessageBoxResult returns MessageBoxResult.No. Consider returning MessageBoxResult.None to clearly indicate an unmapped or unexpected Win32 result.
default:
src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs:1013
- [nitpick] The ordering of MessageBoxResult enum members differs from the primary reference file. For improved readability and maintainability, consider ordering these members consistently with the main implementation.
Cancel = 2,
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
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.
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/PresentationFramework.Tests.csproj: Language not supported
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/MessageBox.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/MessageBox.cs
Show resolved
Hide resolved
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
...ft.DotNet.Wpf/tests/UnitTests/PresentationFramework.Tests/System/Windows/MessageBox.Tests.cs
Outdated
Show resolved
Hide resolved
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.
@bstordrup I got no further comments on this by the way, LGTM.
The whitespace changes are unfortunate but basically correct, it replaces \u0020\r\n
sequence with \r\n
, there's no reason why there should be a space on each line before CRLF
, so imho no reason to painfully revert it.
@bstordrup Thank you for taking up this API proposal, seeing it through to completion, and also contributing the accompanying tests 😊 P.S. @h3xds1nz Thank you for your detailed and thorough review of the proposal! |
@siagupta0202 my pleasure 😊 |
@siagupta0202 happy to :) |
Who is in charge of XML documentation for these? |
@miloush, we are waiting of this PR now : dotnet/dotnet-api-docs#11295 (review) Once this is done, I will make the updates. |
Fixes #9613
Description
The purpose with the pull request is to streamline the
MessageBox.Show
overloads between WinForms and WPF thus making it more intuitive and easier to migrate a WinForms applicatio to WPF.Also, since (on Windows), both WinForms and WPF call into the same underlying Windows API functions, there is in my opinion only little reason not to streamline them.
Customer Impact
The customer impact of not taking this fix is that a migration from WinForms to WPF becomes a bit more complex when it comes to using MessageBox.Show with more options than just Yes/No or OK/Cancel. With the extension of both
MessageBoxButton
andMessageBoxResult
enumerations, a more generous set of options is available for the application after showingMessageBox.Show (...)
method.Regression
This is no regression.
Testing
I tested the extensions of
MessageBoxButton
andMessageBoxResult
enumerations with a sample Wpf application targeting a locally build version of Wpf. It simply had a set ofButton
andTextBlock
controls inMainWindow
, and each of these buttons uses theMessageBoxButton
enumeration value as indicated by the button title. The result ofMessageBox.Show
is then assigned to the correspondingTextBlock
control.Risk
The risk of taking this fix is minimal (if not even none). The WinForms repository already contains these extensions, and they are building upon an existing Windows API.
Microsoft Reviewers: Open in CodeFlow