Merged
Conversation
Theming isn't easy for the system message box and requires using undocumented APIs. To get theming, including a simple themed message box that roughly follows the existing layout. Move the project to the standard SDK which enables using source generators. The existing SDK was a hack for building before WPF and WinForms were officially released on .NET Core. Push the C# version to 12 for collections expressions, default parameters for lambdas, etc. Add CsWin32 for PInvoke source generation. Add PInvokes for getting the modern shell icons for the new dialog. System.Drawing has the new Icons in .NET, but we're still targetting 4.6.2. (Note that some PInvokes have to still be manually defined because we're targetting AnyCPU. Some headers in Windows are defined with nonstandard packing, which makes the SDK generate metadata that is platform specific. For safety they don't generate any of these and they must be manually evaluated. The manual ones I added come from System.Drawing. If we targetted specific architectures this wouldn't be necessary.) If we're able to move to .NET Core in the future we can get more explicit, coherent theming support through WPF or MAUI.
brianrob
reviewed
Aug 14, 2025
Member
brianrob
left a comment
There was a problem hiding this comment.
LGTM. Thanks @JeremyKuhne! Just to confirm - this does not use any undocumented APIs, right? I think I read from your description that the solution you used to avoid undocumented APIs is to create your own dialog, but just want to make sure.
Member
Author
Yeah, I spun a custom one to avoid undocumented features. |
brianrob
approved these changes
Aug 18, 2025
Member
brianrob
left a comment
There was a problem hiding this comment.
LGTM. Thank you @JeremyKuhne!
leculver
added a commit
to leculver/perfview
that referenced
this pull request
Feb 19, 2026
The SecurityCheck callback runs on a background thread during symbol resolution. PR microsoft#2276 replaced System.Windows.MessageBox (Win32-based, no thread affinity) with XamlMessageBox (WPF-based, requires STA thread), causing symbol lookup to fail with 'The calling thread must be STA'. Fix by dispatching the XamlMessageBox.Show call to the UI thread via GuiApp.MainWindow.Dispatcher.Invoke(), consistent with other XamlMessageBox call sites in CommandProcessor.cs and PerfViewData.cs. Fixes microsoft#2300 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Theming isn't easy for the system message box and requires using undocumented APIs. To get theming, including a simple themed message box that roughly follows the existing layout.
Move the project to the standard SDK which enables using source generators. The existing SDK was a hack for building before WPF and WinForms were officially released on .NET Core.
Push the C# version to 12 for collections expressions, default parameters for lambdas, etc.
Add CsWin32 for PInvoke source generation. Add PInvokes for getting the modern shell icons for the new dialog. System.Drawing has the new Icons in .NET, but we're still targetting 4.6.2. (Note that some PInvokes have to still be manually defined because we're targetting AnyCPU. Some headers in Windows are defined with nonstandard packing, which makes the SDK generate metadata that is platform specific. For safety they don't generate any of these and they must be manually evaluated. The manual ones I added come from System.Drawing. If we targetted specific architectures this wouldn't be necessary.)
If we're able to move to .NET Core in the future we can get more explicit, coherent theming support through WPF or MAUI.
Existing:
Themed:
(The light version is not as fully realized, as the theme for that wasn't in the current sources, I did the bare minimum with the intent of following up on the theme sources at some point.)
(The preset dialog doesn't have a real preset string in it, just ran it in the about menu with version text to make sure it was working correctly.)