MicrosoftEdge / MicrosoftEdge/WebView2Feedback
WebView2 Initialization Error in WinPE x64
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Discussed in https://github.com/MicrosoftEdge/WebView2Feedback/discussions/4947
Originally posted by Abithk7-1 November 26, 2024
I'm experiencing an issue with WebView2 initialization in our WinPE x64 environment.
The error I'm encountering is:
System.Runtime.InteropServices.COMException (0x80080005): Server execution failed (Exception from HRESULT: 0x8008005 (CO_E_SERVER_EXEC_FAILURE)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__102.MoveNext()
Environment:
WinPE x64
Framework: 4.8.1
I'm using the following nuget libraries:
- Microsoft.Web.WebView2.Core.dll
- Microsoft.Web.WebView2.Winforms.dll
- Microsoft.Web.WebView2.WPF.dll
The WebView2 Fixed Version Runtime binaries I'm using is: - Microsoft.WebView2.FixedVersionRuntime.130.0.2849.56.x64
My code for initializing WebView2 is as follows:
string exeLocation = AppDomain.CurrentDomain.BaseDirectory;
string webView2Folder = Path.Combine(exeLocation, "WebView2x64");
string logFilePath = Path.Combine(exeLocation, "WebView2Log.txt");
string userDataFolder = Path.Combine(exeLocation, "UserData");
try
{
// Create WebView2 environment with logging enabled
var environment = await CoreWebView2Environment.CreateAsync(
browserExecutableFolder: webView2Folder,
userDataFolder: userDataFolder,
options: new CoreWebView2EnvironmentOptions("--enable-logging --v=1"));
// Initialize WebView2 with the environment
await webView.EnsureCoreWebView2Async(environment);
webView.CoreWebView2.Navigate(Url);
// Log a success message
Log( "WebView2 initialized successfully.");
}
catch (Exception ex)
{
// Log any initialization errors
Log($"Error initializing WebView2: {ex.ToString()}");
}
The folder structure for the WebView2 libraries is as follows:
<myApp>
\Microsoft.Web.WebView2.Core.dll
\Microsoft.Web.WebView2.Winforms.dll
\Microsoft.Web.WebView2.WPF.dll
\runtimes
\win-arm64\native\WebView2Loader.dll (arm64)
\win-x64\native\WebView2Loader.dll (x64)
\win-x86\native\WebView2Loader.dll (x86)
</div>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported CoreWebView2Environment.CreateAsync and EnsureCoreWebView2Async calls, then inspect the WebView2 fixed-runtime folder and runtimes/win-x64/native/WebView2Loader.dll layout. Reproduce the initialization in WinPE x64 with the listed framework and runtime versions; done means establishing the supported configuration or a reproducible cause for the server execution failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100