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

[Question] Using acrylic background in Xaml Island control causes exceptions. #270

Closed ghost closed 4 years ago

ghost commented 4 years ago

Describe the bug

Hi,

I've followed this excellent guide in order to create a custom UWP control in a WPF Net Core 3.1 application. It works perfectly fine in the original state.

However when I modify the window changing the background from a solid color to "Acrylic" the application runs but throughs a few exceptions as seen below then automatically terminates itself before the window is drawn on screen. Do you know what could be the cause of this?

'AcrylicVolumeControl.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Private.CoreLib.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\AcrylicVolumeControl.dll'. Symbols loaded.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\MyUWPApp.exe'. Symbols loaded.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\Microsoft.Toolkit.Win32.UI.XamlHost.winmd'. Module was built without symbols.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Windows\system32\WinMetadata\Windows.UI.Xaml.winmd'. Module was built without symbols.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\mscorlib.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.InteropServices.WindowsRuntime.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\PresentationFramework.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\WindowsBase.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\System.Xaml.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Collections.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Threading.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\System.IO.Packaging.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\netstandard.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Private.Uri.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\PresentationCore.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\DirectWriteForwarder.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.Extensions.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\xamldiagnostics\Core\x64\Microsoft.VisualStudio.DesignTools.WpfTap.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.InteropServices.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.CompilerServices.VisualC.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.Debug.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\Microsoft.Win32.Primitives.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Collections.NonGeneric.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Linq.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\Microsoft.Win32.Registry.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.TraceSource.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Collections.Specialized.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.ComponentModel.Primitives.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.IO.Pipes.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.Process.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Threading.Tasks.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Threading.Thread.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.ObjectModel.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Collections.Concurrent.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.ComponentModel.TypeConverter.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Threading.Timer.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\System.Configuration.ConfigurationManager.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Xml.ReaderWriter.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Private.Xml.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.IO.FileSystem.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Net.WebClient.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Memory.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Security.Cryptography.Algorithms.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Text.Encoding.Extensions.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.ComponentModel.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Resources.ResourceManager.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.Serialization.Xml.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\System.Windows.Extensions.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Private.DataContractSerialization.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.Serialization.Json.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Threading.ThreadPool.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.Serialization.Primitives.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Text.RegularExpressions.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.Emit.ILGeneration.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.Emit.Lightweight.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.Primitives.dll'. 
The thread 0x51dc has exited with code 0 (0x0).
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\UIAutomationTypes.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.Serialization.Formatters.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\Microsoft.Toolkit.Wpf.UI.XamlHost.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Windows\system32\WinMetadata\Windows.Foundation.winmd'. Module was built without symbols.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\Microsoft.Toolkit.Win32.UI.XamlHost.Managed.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Windows\system32\WinMetadata\Windows.UI.winmd'. Module was built without symbols.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.WindowsRuntime.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Numerics.Vectors.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Runtime.WindowsRuntime.UI.Xaml.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\PresentationFramework.Aero2.dll'. 
Exception thrown: 'System.InvalidCastException' in PresentationCore.dll
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.Tracing.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.StackTrace.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\UWPClassLibrary.dll'. Symbols loaded.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Filer\Programmering\VisualStudio\Projekt\AcrylicVolumeControl\AcrylicVolumeControl\bin\x64\Debug\netcoreapp3.1\Microsoft.UI.Xaml.Markup.winmd'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Windows\system32\WinMetadata\Windows.Storage.winmd'. Module was built without symbols.
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Windows\system32\WinMetadata\Windows.ApplicationModel.winmd'. Module was built without symbols.
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Reflection.Metadata.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Collections.Immutable.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Diagnostics.Tools.dll'. 
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.3\UIAutomationProvider.dll'. 
'AcrylicVolumeControl.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.3\System.Buffers.dll'. 
Exception thrown: 'System.InvalidOperationException' in Microsoft.UI.Xaml.Markup.winmd
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
The program '[10192] AcrylicVolumeControl.exe' has exited with code -1073741189 (0xc000027b).

Environment

NuGet Package(s): Microsoft.Toolkit.Wpf.UI.XamlHost

Package Version(s): 6.0.1

Project .NET Version:

Windows 10 Build Number:

App min and target version:

Visual Studio

ghost commented 4 years ago

Hello spacelime, thank you for your interest in Win32!

I have automatically added a "needs triage" label to help get things started. Our team will look into the question and answer ASAP. Other community members may also answer the question and provide feedback 🙌

michael-hawker commented 4 years ago

Thanks @spacelime, can you provide more details on what OS you're on, what VS version you're running, which NuGet package versions you're using?

FYI @marb2000

ghost commented 4 years ago

Thanks @spacelime, can you provide more details on what OS you're on, what VS version you're running, which NuGet package versions you're using?

Thank you, I've updated the post now.

ocalvo commented 4 years ago

Can you please update to the latest version 6.1.1?

Does it still repro?

ghost commented 4 years ago

Hi,

I havn't tested 6.1.1. The problem got solved when I implemented XAML island code directly into the WPF app, skipping the custom UWP control step of the tutorial.

Thank you, Olof

marb2000 commented 4 years ago

Closing it given it's no longer an issue for the developer who could workaround it.