Closed Swiftpaws closed 4 years ago
FileNotFoundException: Could not load file or assembly 'C:\Users\pub\Downloads\Okami.dll'. The system cannot find the file specified.
This part surprises me. AdonisWindow looks for the icon in Assembly.GetEntryAssembly()
which seems to return 'C:\Users\pub\Downloads\Okami.dll' for you. I would expect the entry to be an .exe file.
What does your application structure look like? Does your application only constist of this Okami.dll
? Is there an additional .exe assembly involved? How do they relate? Did you start your app via unmanaged code?
\AdonisWindowIcon_Bug\Demo\Demo> .\bin\Debug\netcoreapp3.1\Demo.exe -> Does not start
AdonisWindowIcon_Bug\Demo\Demo\bin\Debug\netcoreapp3.1> .\Demo.exe -> Works
-> Both work
I have created a test app here -> https://github.com/Swiftpaws/AdonisWindowIcon_Bug
Could you please explain what you mean with > .
in you paths?
I downloaded your demo and for me it runs perfectly. But I am not sure what the difference in those two paths is that you mentioned.
They are command line calls
The first command does not work while the second one does. The difference is the current directory - if the current directory (of the command line) is the same as the .exe it can launch if that is not the case it will not launch
Oh now I see. Sorry it took me so long to understand what you meant. I am now able to reproduce the issue and working on a fix.
I created a PR which solves the issue. At least it works for your demo project. Before merging you can check if it works for your original project as well if you want.
Describe the bug If the application uses the AdonisWindow and is launched with anything but the base directory (where the .dll files are located) as the "Start in" location it will crash at: AdonisUI.Controls.AdonisWindow.GetApplicationIcon()
To Reproduce Steps to reproduce the behavior:
Expected behavior No crash
Screenshots
Additional context The icon visibility in the adonis window does not affect this behaviour
Exception + StackTrace
System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'Okami.Views.MainWindow' that matches the specified binding constraints threw an exception.'
FileNotFoundException: Could not load file or assembly 'C:\Users\pub\Downloads\Okami.dll'. The system cannot find the file specified.
This exception was originally thrown at this call stack: System.Drawing.Icon.ExtractAssociatedIcon(string, int) System.Drawing.Icon.ExtractAssociatedIcon(string) AdonisUI.Controls.AdonisWindow.GetApplicationIcon() AdonisUI.Controls.AdonisWindow.AdonisWindow() Okami.Views.MainWindow.MainWindow()