Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF C# WebView doesn't show any page on win 10

If have tried to test the sample project from Windows community but couldn't get any page running on my machine.

I got those events in event viewer:

Faulting application name: Win32WebViewHost.exe, version: 10.0.17134.1, time stamp: 0xed1839dd
Faulting module name: edgemanager.dll, version: 11.0.17134.165, time stamp: 0x71de0339
Exception code: 0xc0000409
Fault offset: 0x0000000000035694 Faulting process id: 0x2ca4
Faulting application start time: 0x01d433adb58e4f8b
Faulting application path:
C:\Windows\SystemApps\Microsoft.Win32WebViewHost_cw5n1h2txyewy\Win32WebViewHost.exe Faulting module path: C:\WINDOWS\SYSTEM32\edgemanager.dll
Report Id: 40986bf3-66d8-4018-9f7e-81c8b65e42b6
Faulting package full name:
Microsoft.Win32WebViewHost_10.0.17134.1_neutral_neutral_cw5n1h2txyewy Faulting package-relative application ID: Win32WebViewHost

AND:

Faulting application name: wwahost.exe, version: 10.0.17134.165, time stamp: 0xc46b1662
Faulting module name: wwahost.exe, version: 10.0.17134.165, time stamp: 0xc46b1662
Exception code: 0xc0000409
Fault offset: 0x000000000005744c
Faulting process id: 0x3330
Faulting application start time: 0x01d433bcbf627fdd
Faulting application path: C:\Windows\System32\wwahost.exe
Faulting module path: C:\Windows\System32\wwahost.exe
Report Id: 7ebdd067-07b4-4278-a566-531fb78506ac
Faulting package full name:
Microsoft.Win32WebViewHost_10.0.17134.1_neutral_neutral_cw5n1h2txyewy Faulting package-relative application ID: Win32WebViewHost

Ive tried to:

  1. repair VS 2017
  2. installed all .net target versie tot 4.7.2
  3. installed all .net versies tot 4.7.2 in win
  4. did sfc /scannow
  5. did window repair

Sample.zip

Sample Code :

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:WebViewSample"
    xmlns:WPF="clr-namespace:Microsoft.Toolkit.Win32.UI.Controls.WPF;assembly=Microsoft.Toolkit.Win32.UI.Controls" x:Class="WebViewSample.MainWindow"
    mc:Ignorable="d"
    Title="MainWindow" Height="Auto" Width="Auto">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <WPF:WebView Grid.Row="0" x:Name="webView1" HorizontalAlignment="Stretch" Margin="10,10,10,9.5" VerticalAlignment="Stretch" />
    <TextBlock Grid.Row="1" x:Name="textBlock1" ></TextBlock>
</Grid>

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        webView1.DOMContentLoaded += (sender, args) =>
        {
            textBlock1.Text = "Loaded!";
        };

        webView1.Navigate("https://microsoft.com");
    }
}

Extra info :

  • Win 10 Version 1803 (OS Build 17134.165)
  • Test on several machines with random results
like image 650
Paul Avatar asked Nov 08 '22 03:11

Paul


1 Answers

WebView does not support running under an elevated token. see: https://github.com/windows-toolkit/Microsoft.Toolkit.Win32/issues/32#issuecomment-442447380

like image 69
cuiliang Avatar answered Nov 14 '22 21:11

cuiliang