Repository navigation
Fix Screen.DisplayName always being null on Windows - #22593
Open
izakusilov wants to merge 1 commit into
Open
izakusilov wants to merge 1 commit into
izakusilov wants to merge 1 commit into
Conversation
NuGet packagesThe packages for this pull request have been published (workflow run):
|
maxkatz6
approved these changes
Oct 25, 2026
This branch has not been deployed
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.
What does the pull request do?
Fixes
Screen.DisplayNamealways beingnullon Windows.WinScreen.GetDisplayNamenow callsQueryDisplayConfigwith valid arguments, so the monitor's friendly name is returned again.What is the current behavior?
On Windows,
Screen.DisplayNameisnullfor every screen, e.g.desktop.MainWindow.Screens.All[0].DisplayName(reported on 12.1.4).WinScreen.GetDisplayNamepasses a non-nullcurrentTopologyIdpointer toQueryDisplayConfigtogether withQDC_ONLY_ACTIVE_PATHS. According to the documentation, this pointer must beNULLunlessQDC_DATABASE_CURRENTis used; otherwise the call fails withERROR_INVALID_PARAMETER.GetDisplayNametreats that failure as "no name" and returnsnull, so neither the friendly name nor the\\.\DISPLAYnfallback is ever reached.What is the updated/expected behavior with this PR?
Screen.DisplayNamecontains the monitor's friendly name (fromDISPLAYCONFIG_TARGET_DEVICE_NAME), or the GDI device name (e.g.\\.\DISPLAY1) when no matching display path is found.How was the solution implemented (if it's not obvious)?
currentTopologyIdargument from theQueryDisplayConfigcall, so the CsWin32-generated overload that passesNULLis used.Screens_Have_DisplayNameintegration test, which checks that every screen reports a non-nullDisplayName.Checklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #22541