Skip to content
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

[Problem/Bug]: Initialization failed due to a mismatch in DPI awareness (0x8007139F) #4971

Open
vividand opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vividand
Copy link

vividand commented Dec 5, 2024

What happened?

Hello

My company products uses WebView2 Embedded to display web pages.
Some users reported running errors, webview2 failed to load, and the child process msedgewebview2.exe did not start.
debugview log show follow error:
"WebView2: Initialization failed due to a mismatch in DPI awareness. Please ensure that the DPI awareness of the host app matches the DPI awareness of current WebView2 processes using the same user data folder."

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

131.0.2903.70

SDK Version

maybe allversion, only check on 1.0.2849.39,1.0.2045.28

Framework

Win32

Operating System

Windows 10, Windows 11

OS Version

some version include 24h2

Repro steps

The following is the specific environment information of the issue and our attempts:

  • OS version
    win10/win11, one of the users sure be win11 24H2,others version always have.

  • webview2 SDK/Runtime version
    We carefully review the solution of WebView2 Feedback Issue 3008,
    then upgraded webview2Loader from 1.0.2045.28 to 1.0.2849.39, and webview2 runtime upgraded to 131.0.2903.70, but problem still reproduce.
    debugview log refer attached Works.LOG
    works.LOG

(we known that webview2 1.0.2065-prerelease has fixed one issue about DPI compatibility)

  • DPI compatibility setting
    Main Process set flag as PER_MONITOR_AWARE, msedgewebview2.exe uses the default DPI compatibility setting
    The main process set compatibility via SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)
    msedgewebview2.exe default settings: "High DPI Settings" property box is unchecked,
    and the registry entry for compatibility settings is empty for msedgewebview2.exe

  • init parameter attempt
    When calling CreateCoreWebView2EnvironmentWithOptions, I tried using the following parameters, but the problem was not solved
    --disable-gpu-driver-bug-workarounds
    --disable-gpu
    --ignore-gpu-blocklist

  • others third-party APP running status(webview2 used)
    Zoom Workplace have same problem when try to load web page via webview2 in same enviroment PC.
    The child process msedgewebview2.exe is not started, debugview shows the same error reason.
    refer to the attached zoom.LOG
    zoom.LOG

  • other Mircrosoft APP running status
    Widgets.exe and ms-teams.exe running ok.
    Webview2 is loaded normally and msedgewebview2.exe are started successfully
    Webview2 GPU-Render has the same DPI compatibility flag as the parent process(pre_monitor_aware).

  • ETW info
    We use wpr command collect etw information during problem reproduced.
    Send send etl file to email [email protected]
    Please confirm

  • Additional Info
    We have tried the following:
    Manually modify the DPI compatibility settings of msedgewebview2.exe, Properties->Change High DPI Settings->High DPI Scale Override->check "Override High DPI Scale Behavior",
    and value of "Scale Execution Option" is "Application".
    The modified Registry content is as follows:
    C:\Program Files (x86)\Microsoft\EdgeWebView\Application\131.0.2903.70\msedgewebview2.exe ~ DPIUNAWARE
    After the modification, my company's application runs normally, webview2 is loaded successfully, the child process msedgewebview2.exe is started,
    and the Webview2 GPU-Render has the same DPI compatibility flag as the main process.
    But, other Extensions programs launched through the MS Edge browser cannot display the page normally.
    Please refer to this attempt, I hope it will help you find the cause of the problem.

Thanks for check
Hope to get support and bug fixes in time.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

SDK 1.0.2849.39, runtime 131.0.2903.70

@vividand vividand added the bug Something isn't working label Dec 5, 2024
@LiangTheDev
Copy link
Member

From the trace, it looks like WebView2 code in app process detected that the app is running with DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 and carried that info to msedgewebview2.exe process, but somehow the code in msedgewebview2.exe process failed to set the same dpi awareness.

2 possibilities that I could think of: some app compat settings is somehow active for msedgewebview2.exe, or some third party code set dpi awareness before Edge code does (or implicitly does that by parenting hwnds between msedgewebview2.exe and another process).

  1. Could you check whether there is a __COMPAT_LAYER environment variable set on main msedgewebview2.exe process? You can use procexp.exe to see all the environment variables of a process in the Environment tab of the process properties window.

  2. Temporarily disable/remove C:\Program Files\RaonSecure\NxWeb\TENXWGuard64.dll to see whether that makes any difference.

Besides that, if the app uses ICoreWebView2CompositionController instead of hwnd based ICoreWebView2Controller, then dpi awareness would not be an issue. Not sure you would be able to do that for the app.

You stated that the issue happens for some users. Is there any pattern for those users vs the users where the app works?

@richard-chen-coding
Copy link

We are seeing the same error in some of the machines, and there is a noticeable trace in the debug view log
qt.qpa.window: SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) failed: COM error 0x5: Access is denied.
debug_view.log
Could they be related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants