Using Windows UI Library 3 Preview 2 (July 2020) that was released just yesterday. On latest version of VS2019 - Preview
, followed this official tutorial Get started with WinUI 3 for UWP apps to create a desktop project. Project successfully compiles but gives the following error when I click on the link Go to WinUI desktop window
at the MainPage.xaml
page. This link is supposed to open the WinUI Desktop Windows
that I added as explained in step 7
of this MS team's tutorial. The error occurs at the constructor
of the MainWindow.xaml.cs
file. I'm using Windows10 Pro ver. 1903
:
System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source= StackTrace:
MainPage.xaml:
<Page
x:Class="WinUI_UWPTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
....
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<HyperlinkButton x:Name="hlbtnTest" Content="Go to WinUI desktop window" Click="hlbtnTest_Click"/>
<Frame x:Name="frameMain"/>
</Grid>
</Page>
MainPage.xaml.cs:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void hlbtnTest_Click(object sender, RoutedEventArgs e)
{
frameMain.Navigate(typeof(BlankWindow1));
}
}
BlankWindow1.xaml:
<Window
x:Class="WinUI_UWPTest.BlankWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
.....
mc:Ignorable="d">
<Grid>
<TextBlock>WinUI Desktop Window</TextBlock>
</Grid>
</Window>
BlankWindow1.xaml.cs: Error occurs at InitializeComponent();
line below:
public sealed partial class BlankWindow1 : Window
{
public BlankWindow1()
{
this.InitializeComponent();
}
}
App.xaml:
<Application
x:Class="WinUI_UWPTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUI_UWPTest">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
User contributions licensed under CC BY-SA 3.0