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
383 stars 89 forks source link

App crashes because of CreateWinRTRegistration should not put UWP project Packaging Outputs into the CopyToOutputDirectory #239

Closed sbanni closed 4 years ago

sbanni commented 4 years ago

Sample Project

The issue is that 'CreateWinRTRegistration' gets run when the packaging project is collecting all the required files from the WpfCoreApplication; 'CreateWinRTRegistration' builds the UWP project and collects all the packaging outputs and puts them into Content items. These then get copied to the output directory overwriting the WpfCoreApplication dependency files.

When the sample project runs successfully it should just display a blank window, instead it is crashing with these following errors: 1.) Could not load file or assembly 'System.Runtime, Version=4.2.2.0

  1. Use the package wizard on the ApplicationProject to build a Debug x64 package.
  2. Install and run the package
  3. Check the windows Application event log for the error

2.) Could not load type 'System.IAsyncDisposable' from assembly 'System.Runtime, Version=4.2.1.0

  1. Change the target framework of the WpfCoreApplication to .Net Core 3.0
  2. Use the package wizard on the ApplicationProject to build a Debug x64 package.
  3. Install and run the package
  4. Check the windows Application event log for the error

3.) Could not load type 'System.Windows.Threading.DispatcherObject' from assembly 'WindowsBase

  1. Ensure the target framework of the WpfCoreApplication is set to .Net Core 3.0
  2. Use the package wizard on the ApplicationProject to build a Release x64 package.
  3. Install and run the package
  4. Check the windows Application event log for the error

If you change the version of the XamlHost package on the WpfCoreApplication project from 6.0.0 to 6.0.0-preview6.4 and repeat the above steps you should no longer see any of those errors when packaging and running the application.

ghost commented 4 years ago

Hello sbanni, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

michael-hawker commented 4 years ago

@marb2000 @ocalvo thoughts?

gcookemoto commented 4 years ago

This still appears to be an issue using the latest version (6.0.1) of the Microsoft.Toolkit.Wpf.UI.XamlHost package. This can be reproduced by upgrading the Microsoft.Toolkit.Wpf.UI.XamlHost package in the sample repository above.

We see exactly the same problem in our own XAML islands application, and have also reproduced it in a minimal XAML islands to which we added a use of Microsoft.Extensions.Hosting.