Description
Description
Using the newly released Microsoft.Web.WebView2.DevToolsProtocolExtension package to access the DevTools Protocol API results in this exception:
"System.ArgumentException: Value does not fall within the expected range."
Version
SDK: Microsoft.Web.WebView2 1.0.824-prerelease, Microsoft.Web.WebView2.DevToolsProtocolExtension 1.0.824
Runtime: Evergreen, 89.0.774.57
Framework: Windows.Forms, .NET Framework 4.8
OS: Win10
Repro Steps
Based on the steps provided here:
https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/chromium-devtools-protocol
async void InitializeAsync()
{
await webView.EnsureCoreWebView2Async(null);
DevToolsProtocolHelper helper = webView.CoreWebView2.GetDevToolsProtocolHelper();
webView.CoreWebView2.Navigate(@"C:\temp\test.html");
// Latitude and longitude for Paris, France.
double latitude = 48.857024082572565;
double longitude = 2.3161581601457386;
double accuracy = 1;
await helper.Emulation.SetGeolocationOverrideAsync(latitude, longitude, accuracy);
// OK so far
// Results in exception
var x = await helper.SystemInfo.GetInfoAsync();
MessageBox.Show(x.ModelName);
}
Here are the exception details:
************** Exception Text **************
System.ArgumentException: Value does not fall within the expected range.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Web.WebView2.Core.CoreWebView2.d__134.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.WebView2.Core.DevToolsProtocolExtension.SystemInfo.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at WindowsFormsApp1.Form1.d__1.MoveNext() in C:\Users\volar\source\repos\WindowsFormsApp1\WindowsFormsApp1\Form1.cs:line 37
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)
Thanks.