How do I debug this? Thanks in advance! Code is several hundred lines of VB.NET and part of a larger set of code; this is the logic flow. Replacing an Internet Explorer WebBrowser control based application. The time for WebView2_CoreWebView2InitializationCompleted indicates if it will work or fail.
Windows .NET framework form creates form containing WebView2 V1.0.1264.42 When run in Visual Studio 2019 works. When run from command prompt, fails.
WebView2 form: form load event call async InitializeCoreWebView2Async
InitializeCoreWebView2Async: 2a) CoreWebView2Environment cwv2Environment = Await CoreWebView2Environment.CreateAsync(Nothing, userDataFolder, options) 2b) Await WebView2.EnsureCoreWebView2Async(cwv2Environment)
WebView2_CoreWebView2InitializationCompleted is raised (either 3550 milliseconds and rest works or ~600 milliseconds and rest fails) 3a) UserDataFolder is confirmed as set 3b) adds event handlers for: WebView2.CoreWebView2.WebResourceRequested WebView2.CoreWebView2.WebResourceResponseReceived WebView2.CoreWebView2.DownloadStarting 3c) WebView2.CoreWebView2.AddWebResourceRequestedFilter("*",Microsoft.Web.WebView2.Core.CoreWebView2WebResourceContext.All) 3d) CoreWebView2WebResourceRequest request = WebView2.CoreWebView2.Environment.CreateWebResourceRequest( URIToNavigateTo, "POST", streamBodyToUpload, "Content-Type: application/vnd.microsoft.portable-executable") 3e) WebView2.CoreWebView2.NavigateWithWebResourceRequest(request)
WebView2_NavigationStarting is raised 4a) CoreWebView2WebResourceRequestedEventArgs.ResourceContext is "Document"
5)When this works only in Visual Studio: 5a) CoreWebView2_WebResourceResponseReceived There is a header with Transfer-Encoding chunked
5b) WebView2_NavigationCompleted 5c) Webview2_DownloadStarting 6 - 10) Remaining download events fire and download is completely received
- When this fails, nothing occurs until a timeout of unable to reach the server 5a) CoreWebView2_WebResourceResponseReceived Header "image/svg+xml"