Microsoft Edge WebView2 - The format of the URI could not be determined

1.4k views Asked by At

This post is about Microsoft Edge WebView2 control. When working on WebView2WpfBrowser sample from github here, I get the following error at the following code in file MainWindow.xaml.cs file. The sample runs fine except when in the the address bar I type a URL and click on Go button next to the address bar. URL I had typed was Microsoft.com:

Error:

System.UriFormatException HResult=0x80131537 Message=Invalid URI: The format of the URI could not be determined. Source=System.Private.Uri

Code:

void GoToPageCmdExecuted(object target, ExecutedRoutedEventArgs e)
{
    webView.Source = new Uri((string)e.Parameter);
}

Question: What could be the cause of the error, and how can it be fixed?

UPDATE:

Just noticed that the error occurs if you don't type the full URL format (e.g. https://www.microsoft.com/). It throws the above error if you, for example, just type microsoft.com or even www.microsoft.com.

So now, instead of a question, it's probably a bug report.

0

There are 0 answers