Performance issue WindowsXamlHost v6.1.2 if its child is CaptureElement (but there is no issue with v. 5.1.1) #355
Description
Describe the bug
WindowsXamlHost hosts CaptureElement, The time between InitializeComponent() and triggering CaptureElement.Loaded event is 7.4 sec for WindowsXamlHiost v 6.1.2, but the same time for WindowsXamlHiost v 5.1.1 is less than 0.4 sec,
Code:
Main window has the only element in the grid:
<Grid>
<xamlhost:WindowsXamlHost Name="XamlHost1" InitialTypeName="Windows.UI.Xaml.Controls.CaptureElement" />
</Grid>
MainWindow.xaml.cs:
CaptureElement captureElement { get { return (CaptureElement) XamlHost1.Child; } }
public MainWindow()
{
InitializeComponent();
XamlHost1.Child = new CaptureElement() { Stretch = Windows.UI.Xaml.Media.Stretch.Uniform};
captureElement.Loaded += CaptureElement_Loaded;
}
private void CaptureElement_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
}
CaptureElement_Loaded tgriggers in 7.4 sec for WindowsXamlHost v.6.1.2 and in 0.3 - 0.4 sec for v. 5.1.1.
Test for 6.1.2. was done with NuGet packets. It took 7.4 sec
Then to test with 5.1.1 the reference to Windows.Foundation.UniversalApiContract was replaced by refence to Windows.winmd v 10.0.19041.0 (C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.19041.0\Windows.winmd)
With this replacement the time for WindowsXamlHiost v 6.1.2 remains the same. But when I change reference to WindowsXamlHiost v 5.1.1 I got 0.3 sec
OS: Windows10 22H2.
- Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work: 5.1.1
Steps to Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
It is expected that window loading takes 0.4 sec as it was for v 5.1.1 but not more than 7 sec.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
NuGet Package(s):
<packages>
<package id="Microsoft.Toolkit.UI.XamlHost" version="6.1.2" targetFramework="net472" />
<package id="Microsoft.Toolkit.Win32.UI.SDK" version="6.1.2" targetFramework="net472" />
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.1.2" targetFramework="net472" />
<package id="Microsoft.Toolkit.Wpf.UI.XamlHost" version="6.1.2" targetFramework="net472" />
<package id="Microsoft.Windows.SDK.Contracts" version="10.0.18362.2005" targetFramework="net472" />
<package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net472" />
<package id="System.Runtime.WindowsRuntime.UI.Xaml" version="4.6.0" targetFramework="net472" />
</packages>
Package Version(s):
Project .NET Version:
- [ x] .NET Framework (version: 4.7.2)
- [ ] .NET Core 3
- [ ] .NET Core 3.1 Preview (version: )
Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (build number: )
App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)
Device form factor:
- [ ] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT
Visual Studio
- [ ] 2017 (version: )
- [ x] 2019 (version: 16.11.24)
- [ ] 2019 Preview (version: )
Additional context
Add any other context about the problem here.
Activity