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

Webview2 cannot be created when a WinUI3.0 desktop app is built as partialTrust #7982

Open
koenvd opened this issue Nov 30, 2022 · 11 comments
Open
Labels
area-WebView bug Something isn't working team-Rendering Issue for the Rendering team

Comments

@koenvd
Copy link

koenvd commented Nov 30, 2022

Describe the bug

This issue is probably on the border between WinUI3.0 and WindowsAppSDK but creating it here since it's related to how the app is being built.

I was trying to move away from running a win32 WinUI 3.0 desktop app full trust to running it partial trust as explained here https://nicksnettravels.builttoroam.com/windows-ui-as-partial-trust/

The app can be successfully built but upon running I can no longer create an instance of a Webview2 control.

exception_creating_webview2

I kind of get that this exception is probably expected since the app probably has to load dll"s from outside it's container to be able to instantiate a Webview2 control.

However still logging this since:

  • It might be a nice feature to be able to move away from running full trust and be able to create a Webbview2
  • I hope this is taking into account when we want to upload the app to the Windows Store and get it certified.
  • I don't know how this is done in WinUI2.0 and if you need to run the app full trust as well there to be able to instantatie a Webview2 control.

Steps to reproduce the bug

  1. Create WinUI3.0 desktop app
  2. Add Webview2 control
  3. Build the app as partial trusted

Run the app and notice an exception being thrown.

Expected behavior

Ideally no exception should be thrown, or a dedicated capability is introduced to still allow to create a Webview2 control when the app is partial trusted.

Screenshots

No response

NuGet package version

Windows App SDK 1.2.1: 1.2.221116.1

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 21H2 (22000)

IDE

Visual Studio 2022

Additional context

No response

@gabbybilka gabbybilka transferred this issue from microsoft/WindowsAppSDK Dec 1, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 1, 2022
@bpulliam bpulliam added area-WebView team-Rendering Issue for the Rendering team and removed needs-triage Issue needs to be triaged by the area owners labels Dec 8, 2022
@kovdu
Copy link

kovdu commented Jan 26, 2023

Maybe this #7190 is related?
And from there it looks like it might have worked in the past?

Still interested to know if this should or can work.

@koenvd
Copy link
Author

koenvd commented Feb 16, 2023

I want to go through certification on the Microsoft Store and still need to add fullTrust as capability when using a Webview2 control.

So still wondering if there's a way to use a Webview2 when the app is partialTrust @bpulliam ?
(Mentioning you since not sure who else I could ask this).

@koenvd koenvd changed the title Webview2 cannot be created when an app is built as partialTrust Webview2 cannot be created when a WinUI3.0 desktop app is built as partialTrust Feb 16, 2023
@kovdu
Copy link

kovdu commented Feb 17, 2023

This is the stack trace.

Apparently 'Window creation request failed.' exception being thrown.

'App.exe' (Win32): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.Impl.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.Web.WebView2.Core.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Users\Koen\AppData\Local\Microsoft\Edge SxS\Application\112.0.1683.0\EBWebView\x64\EmbeddedBrowserWebView.dll'. 
The thread 0x164c has exited with code 0 (0x0).
'App.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Symbols loaded.
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Window creation request failed.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(1) tid(5210) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Window creation request failed.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(2) tid(5210) 8007007E The specified module could not be found.
'App.exe' (Win32): Loaded 'C:\Windows\System32\Windows.System.Profile.PlatformDiagnosticsAndUsageDataSettings.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Windows\System32\DiagnosticDataSettings.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. Symbols loaded.
'App.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Catastrophic failure'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(3) tid(5210) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x0000009314D7BEB0.

@kovdu
Copy link

kovdu commented Feb 17, 2023

Noticed I was using Canary version of Webview2 runtime but same thing happening with Stable Release version. Runtime is loaded from a different folder, same error tough.

'App.exe' (Win32): Loaded 'C:\Windows\System32\cabinet.dll'. Symbols loaded.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
'App.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.Web.WebView2.Core.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Program Files (x86)\Microsoft\EdgeWebView\Application\110.0.1587.46\EBWebView\x64\EmbeddedBrowserWebView.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Symbols loaded.
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Window creation request failed.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(1) tid(e08) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Window creation request failed.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(2) tid(e08) 8007007E The specified module could not be found.
'App.exe' (Win32): Loaded 'C:\Windows\System32\Windows.System.Profile.PlatformDiagnosticsAndUsageDataSettings.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Windows\System32\DiagnosticDataSettings.dll'. Symbols loaded.
'App.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'. Symbols loaded.
'App.exe' (Win32): Unloaded 'C:\Windows\System32\policymanager.dll'
Exception thrown at 0x00007FFCBE2D441C (KernelBase.dll) in App.exe: WinRT originate error - 0x8000FFFF : 'Catastrophic failure'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFCBEC390CE: (caller: 00007FFCBEB1C59B) ReturnHr(3) tid(e08) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000488D37BEC0.

Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000488D379A70.

Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000488D37BDD0.

Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Microsoft.Web.WebView2.Core.dll!00007FFBBDC46B82: ReturnHr(1) tid(e08) 8000FFFF Catastrophic failure
    Msg:[winrt::hresult_error: Catastrophic failure] 
Exception thrown at 0x00007FFCBE2D441C in App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000488D37BF70.

@eduardobragaxz
Copy link

Not only when set to PartialTrust, but also if making the app single instance.

@koenvd
Copy link
Author

koenvd commented Jun 26, 2023

Wondering if a fix for this is being considered @bpulliam @chigy ?

@chigy
Copy link
Member

chigy commented Jun 26, 2023

@koenvd , we currently do not have a plan to address this issue in the near future.

@duncanmacmichael duncanmacmichael added the bug Something isn't working label Oct 23, 2023
@orosbogdan
Copy link

Also facing the same issue with MAUI blazor hybrid on .NET 8, it renders a blank page when using partial trust.

@dahlita
Copy link

dahlita commented Apr 15, 2024

Facing the same issue as well;
is there any workaround to get the webview to load?
Without putting the entire app in FullTrust mode?

@epsmae
Copy link

epsmae commented May 31, 2024

Any update on that? @chigy I hope this was a joke that you won't address this issue.
Don't understand why I should give an application full trust only for initializing a webview.
Also not sure how I should explain that to the users of the app.

@epsmae
Copy link

epsmae commented Jul 31, 2024

@chigy Any update? @dahlita @orosbogdan did you find a workaround?

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

No branches or pull requests

9 participants