Describe the bug
When I go to publish an app using AdonisUI.Controls.AdonisWindow as the main window and the "produce single file" option is set, the application will fail to start.
To Reproduce
Steps to reproduce the behavior:
Create a new .NET WPF Application (.NET 5.0)
Add AdonisUI.ClassicTheme through NuGet (current version 1.17.0)
Add the AdonisUI resources to App.xaml
Change the MainWindow from a Window to a AdonisUI.Controls.AdonisWindow
Publish app for win-x64 and have "Produce single file" option checked
Try to run published executable
See error
Expected behavior
The application will start normally.
Additional context
From Event Viewer:
Application: AdonisFailToStart.exe
CoreCLR Version: 5.0.521.16609
.NET Version: 5.0.5
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'AdonisFailToStart.MainWindow' that matches the specified binding constraints threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'D:\playground\csharp\AdonisFailToStart\AdonisFailToStart\bin\Release\net5.0-windows\publish\<Unknown>'. The system cannot find the file specified.
File name: 'D:\playground\csharp\AdonisFailToStart\AdonisFailToStart\bin\Release\net5.0-windows\publish\<Unknown>'
at System.Drawing.Icon.ExtractAssociatedIcon(String filePath, Int32 index)
at System.Drawing.Icon.ExtractAssociatedIcon(String filePath)
at AdonisUI.Controls.AdonisWindow.GetApplicationIcon()
at AdonisUI.Controls.AdonisWindow..ctor()
at AdonisFailToStart.MainWindow..ctor()
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at AdonisFailToStart.App.Main()
Describe the bug When I go to publish an app using
AdonisUI.Controls.AdonisWindow
as the main window and the "produce single file" option is set, the application will fail to start.To Reproduce Steps to reproduce the behavior:
App.xaml
MainWindow
from aWindow
to aAdonisUI.Controls.AdonisWindow
win-x64
and have "Produce single file" option checkedExpected behavior The application will start normally.
Additional context From Event Viewer: