Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Aditi Arora 2021

@Aditi Arora 2021
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Initialize Webview2 in WPF Application work for windows user authentication
    A Aditi Arora 2021

    I am facing an exception while WebView initialize. It is working perfectly fine when i debug my code on VS 2019 but when i make an installer and install it on VM Windows 10 Machine it gives me an exception which i can get with help of Logs. I have added UDF as well in my client machine and install Microsoft edge runtime(124.0.2478.97) Please Suggest any one what i need to add to resolve this issue. Code Block

    MainWindow.xaml.cs
    using Microsoft.Web.WebView2.Core;
    using Microsoft.Web.WebView2.Wpf;
    public MainWindow()
    {
    InitializeComponent();
    InitializeAndNavigateAsync( url);
    }
    public async Task InitializeAndNavigateAsync(string url)
    {
    await InitializeWebViewAsync();
    await NavigateToUrlAsync(url);
    }

        private async Task InitializeWebViewAsync()
        {
            try
            {
                log.Debug($"WebView2 initialize start");
                await webView.EnsureCoreWebView2Async(null);
                log.Debug($"WebView2 initialize stop");
            }
            catch (Exception e)
            {
                log.Debug($"WebView2 initialization failed.{e.Message}");
                log.Debug($"WebView2 initialization failed.{e.StackTrace}");
            }
            
        }
    
        private async Task NavigateToUrlAsync(string url)
        {
            try
            {
                log.Debug($"WebView2 NavigateToUrlAsync start");
                webView.CoreWebView2.Navigate(url);
                log.Debug($"WebView2 NavigateToUrlAsync stop");
            }
            catch (Exception e)
            {
                log.Debug($"WebView2 NavigateToUrlAsync failed.{e.Message}");
                log.Debug($"WebView2 NavigateToUrlAsync failed.{e.StackTrace}");
               
            }
          
        }
    

    Exception is :

    WebView2 initialization failed.Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))
    2024-05-14 06:34:45.4923|DEBUG|debug|WebView2 initialization failed. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
    at Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__80.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAw

    WPF wpf debugging help csharp asp-net
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups