Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WebView2 - Edge can't access Program Files
#1
Hi, I'm trying to run the example for WebView2 from the Cookbook.  I get this error:
Quote:We couldn't create the data directory

Microsoft Edge can't read and write to its data directory:

        C:\Program Files\LibreAutomate\Au.Task.exe.WebView2\EBWebView

I've tried changing the cache directory with the code commented out in the code box below, but when I uncomment those lines I get the following error:
Quote:System.InvalidOperationException: EnsureCoreWebView2Async cannot be used before the application's event loop has started running.
 
Code:
Copy      Help
/*/ nuget -\Microsoft.Web.WebView2; /*/

using Microsoft.Web.WebView2.Wpf;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Web.WebView2.Core;

var b = new wpfBuilder("Window").WinSize(700, 600);

//var env = await CoreWebView2Environment.CreateAsync(null, @"C:\Temp", null);
b.Row(-1).Add(out WebView2 k);
k.Source = new("https://www.google.com");
b.R.AddSeparator();
b.R.AddOkCancel();
b.End();
//await k.EnsureCoreWebView2Async(env);
if (!b.ShowDialog()) return;
I've tried placing the offending line most places in the script, but I always get the 'event loop' error.

Thanks very much for your help!
Regards,
burque505


Messages In This Thread
WebView2 - Edge can't access Program Files - by burque505 - 06-10-2023, 07:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)