chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.98k stars 279 forks source link

Closing Frameless Window causes crash #265

Closed donotcodeit closed 3 years ago

donotcodeit commented 3 years ago

There's minimum reproduceable app: https://github.com/donotcodeit/ChromelyMin51/tree/repro/error-on-close

Steps to reproduce:

Exception is a little transient, probably because it happens inside of Task.Run, but I was able to reproduce it every 2 out of 3 times.

I didn't tested it in any mode but Frameless. Exception will be thrown in NativeHostBase, so it is probably not related only to Frameless.

donotcodeit commented 3 years ago

I also can confirm that process will not be killed when exception happens: image

mattkol commented 3 years ago

@donotcodeit Please is this still happening?

donotcodeit commented 3 years ago

@mattkol i've just tested it - yes, it is still happening.

donotcodeit commented 3 years ago

Exception happening in a NativeHostBase.cs. Do we really need to kill UI process after exiting out of message loop? image

mattkol commented 3 years ago

@donotcodeit looks like it was fixing an issue that was reported. I really do not think it is needed, but not a bad safeguard. I removed from the background thread and also checked to ensure that the process id is valid. I am sure 99.9% of the time that will not be called.

https://github.com/chromelyapps/Chromely/commit/d05b574f1c4eacfefc827ebb7fc4f6e1c6548b5c

donotcodeit commented 3 years ago

@mattkol I've tested - it's OK now. Thanks!