MicrosoftEdge / MicrosoftEdge/WebView2Feedback

EnsureCoreWebView2Async throws "ArgumentException: The path is not of a legal form." on versions newer than 1.0.1072.54

Open
#2,447 12 comments 0 reactions 1 assignee View on GitHub

@champnic is already working on this.

Since May 11, 2022.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description

We tried updating our WebView2 control to the latest version but after installing it our program throws this exception (nothing else was changed in code): ArgumentException: The path is not of a legal form.

To test whether or not this bug will persist, we made a separate WinForms app and copied the exact same code to it (with the latest version 1.0.1210.39 installed) and it worked without problems. Below, I will provide screenshots of both apps.

Version
SDK: 1.0.1210.39 (and down to 1.0.1072.54)
Framework: WinForms
OS: Win10

Repro Steps

Make a function for initializing the WebView2 Control:

async void InitWebView()
        {
            await webView21.EnsureCoreWebView2Async(CoreWebView2Environment.CreateAsync(null, null, new CoreWebView2EnvironmentOptions { Language = "de-DE" }).Result);
            webView21.CoreWebView2.Navigate(Path.GetFullPath("C:\\Users\\Asus\\source\\repos\\WebView2 New version test\\WebView2 New version test\\bin\\Debug\\webview21.html"));
        }

Should initialize the component but instead throws the error that path is not of a legal form.

Screenshots
The dummy app which does NOT cause any errors:
dummyApp
dummyAppForm

This app runs fine and throws no exceptions. It is basically a form with a webView2 on it and navigates to a local html file.

Our app is a bit more complex but it basically adds a webView2 control (which we called TextBox2Control) to the panel and is used as a text editor.
This is what happens when we try to add it after updating our webView2 to 1.0.1210.39 (or any other version higher than the original one it was made on, which is 1.0.1072.54).
TextEditorApp
ErrorMessage

This is obviously not intended, this is the app when we return the version to 1.0.1072.54:
Panel

Additional context
The component is being used as a textbox, it worked perfectly fine on version 1.0.1072.54 (the version it was made on, and it works for previous versions as well, meaning we tried downgrading below 1.0.1072.54 and it still worked, when trying to update it however, error arises as seen in the screenshots).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.