MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
452 stars 55 forks source link

[WPF] Content does not load if WPF app is started from debugger #859

Open PaulFreund opened 3 years ago

PaulFreund commented 3 years ago

Description The application works when started from explorer but Edge does not open the page if started from Visual Studio 2019 Preview 3. It is possible to interact with the edge (right click, inspect, etc.) but nothing is loaded.

Version SDK: WebView2.1.0.721-prerelease Runtime: Version 90.0.779.0 (Official build) canary (64-bit) Framework: WPF, .Net Framework 4.8 and 4.7.2 OS: Windows 10 10.0.19041

Repro Steps

  1. Follow the guide at https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/wpf
  2. Start with Debugger in Visual Studio
  3. Source page does not load

It also seems that crashdumps are created

DbgView log

[11412] JsonRpc Error: 10 : [11412] Exception thrown from request "0" for method GetResult: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.DiagnosticsHub.DataWarehouse.DataWarehouseServiceModuleException: Unknown result ID: 0 [11412] at Microsoft.DiagnosticsHub.DataWarehouse.ServiceModule.Controllers.DataWarehouseController.GetResult(GetResultPayload requestData, Guid taskId, CancellationToken cancellationToken) [11412] --- End of inner exception stack trace --- [11412] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) [11412] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) [11412] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [11412] at StreamJsonRpc.TargetMethod.d19.MoveNext() [11412] --- End of stack trace from previous location where exception was thrown --- [11412] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [11412] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [11412] at StreamJsonRpc.JsonRpc.d152.MoveNext() [11412] JsonRpc Error: 10 : [11412] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.DiagnosticsHub.DataWarehouse.DataWarehouseServiceModuleException: Unknown result ID: 0 [11412] at Microsoft.DiagnosticsHub.DataWarehouse.ServiceModule.Controllers.DataWarehouseController.GetResult(GetResultPayload requestData, Guid taskId, CancellationToken cancellationToken) [11412] --- End of inner exception stack trace --- [11412] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) [11412] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) [11412] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [11412] at StreamJsonRpc.TargetMethod.d19.MoveNext() [11412] --- End of stack trace from previous location where exception was thrown --- [11412] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [11412] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [11412] at StreamJsonRpc.JsonRpc.d152.MoveNext(), GetResult, 0, Newtonsoft.Json.Linq.JToken[] [11412] JsonRpc Error: 10 : [11412] Exception thrown from request "0" for method GetResult: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.DiagnosticsHub.DataWarehouse.DataWarehouseServiceModuleException: Unknown result ID: 0 [11412] at Microsoft.DiagnosticsHub.DataWarehouse.ServiceModule.Controllers.DataWarehouseController.GetResult(GetResultPayload requestData, Guid taskId, CancellationToken cancellationToken) [11412] --- End of inner exception stack trace --- [11412] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) [11412] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) [11412] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [11412] at StreamJsonRpc.TargetMethod.d19.MoveNext() [11412] --- End of stack trace from previous location where exception was thrown --- [11412] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [11412] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [11412] at StreamJsonRpc.JsonRpc.d152.MoveNext() [11412] JsonRpc Error: 10 : [11412] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.DiagnosticsHub.DataWarehouse.DataWarehouseServiceModuleException: Unknown result ID: 0 [11412] at Microsoft.DiagnosticsHub.DataWarehouse.ServiceModule.Controllers.DataWarehouseController.GetResult(GetResultPayload requestData, Guid taskId, CancellationToken cancellationToken) [11412] --- End of inner exception stack trace --- [11412] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) [11412] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) [11412] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [11412] at StreamJsonRpc.TargetMethod.d19.MoveNext() [11412] --- End of stack trace from previous location where exception was thrown --- [11412] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [11412] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [11412] at StreamJsonRpc.JsonRpc.d152.MoveNext(), GetResult, 0, Newtonsoft.Json.Linq.JToken[] [42200] RecursiveDirectoryCreate( C:\prj\Atum\Atum\bin\Debug\Atum.exe.WebView2\EBWebView directory exists ) [42252] [0127/085102.214:ERROR:filesystem_win.cc(129)] GetFileAttributes C:\prj\Atum\Atum\bin\Debug\Atum.exe.WebView2\EBWebView\Crashpad\attachments\e2c974a9-f832-4ad3-9787-e1b9c19ec63c: The system cannot find the path specified. (0x3)

AB#31582817

champnic commented 3 years ago

Thanks for the report @PaulFreund! I've added a bug on our backlog to take a further look. Do you happen to have an older Visual Studio installed to see if you can repro the issue there?

PaulFreund commented 3 years ago

Thanks for your feedback! I just tried with Visual Studio 2019 Version 16.8.4. It seems in the end that it is a race condition of some sort because the first time I got an error loading page, the second time it worked, from there it didn't work anymore for 10 retries. In the stable version of Visual Studio the DbgView only contains:

[42252] [0127/085102.214:ERROR:filesystem_win.cc(129)] GetFileAttributes C:\prj\Atum\Atum\bin\Debug\Atum.exe.WebView2\EBWebView\Crashpad\attachments\e2c974a9-f832-4ad3-9787-e1b9c19ec63c: The system cannot find the path specified. (0x3)

Most likely the same race condition applies to the newer version of VS but it did not win yet.

PaulFreund commented 3 years ago

I retested with the newest prerelease version of WebView2 (1.0.781) and the error persists in Visual Studio 2019 Preview.

However I was able to debug the project with VS Code (clr debugger with portable debug information) and there everything works and I can debug, tried ~10 times.

So it seams to be specific to the VS debugger

champnic commented 3 years ago

Thanks for the follow-up! I've created a bug on our backlog to take a look.