CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
384 stars 89 forks source link

WebView: blank page on some machines #178

Open Myrmex opened 5 years ago

Myrmex commented 5 years ago

I'm submitting a...

Current behavior

The WebView works fine in my development machines, but in most client machines just shows a blank page.

Expected behavior

The WebView should show the intended page, or at least throw some error.

Minimal reproduction of the problem with instructions

To reproduce the issue, I created a WPF app which just shows the Google search page on load, as follows (Visual Studio 2019 Preview 4):

  1. create a new .NET Core WPF app.
  2. add the WPF WebView package. The resulting csproj is thus:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <UseWPF>true</UseWPF>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Toolkit.Wpf.UI.Controls.WebView" Version="6.0.0-preview7.1" />
  </ItemGroup>
</Project>
  1. add the WebView control to the MainWindow page:
<Window x:Class="WebViewRepro.MainWindow"
        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:WebViewRepro"
        xmlns:toolkit="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView"
        mc:Ignorable="d"
        Loaded="Window_Loaded"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <toolkit:WebView Name="_web" AllowDrop="False"/>
    </Grid>
</Window>
  1. in the Window_Loaded code-behind event handler, just load a page from the internet:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
    _web.Navigate("https://www.google.com");
}

To test this outside my development machines, I run a Windows Sandbox instance, publish the repro app, copy the published files to it, and run. The app starts with no apparent error, but the page shown is blank. My Sandbox OS is as follows:

Windows 10 Enterprise
Version 1903
OS build 18362.356

Environment

Nuget Package(s): 

- Microsoft.Toolkit.Wpf.UI.Controls.WebView

Package Version(s): 

- 6.0.0-preview7.1

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Mobile
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x ] 2019 Preview (version: 4)
keytrap-x86 commented 4 years ago

Same over here

Cannot Navigate to any page. It has worked once, and then never again. (Even with a new project or WebView samples..)