simon-knuth / scanner

An all-in-one scanner app built for the Universal Windows Platform
https://simon-knuth.github.io/scanner/index
Mozilla Public License 2.0
479 stars 28 forks source link

The app crashes on Windows 10 #50

Closed marticliment closed 2 years ago

marticliment commented 2 years ago

Describe the bug After updating to 3.0.1.0, the app crashes on launch on Windows 10 (On Windows 11 runs fine)

To Reproduce Steps to reproduce the behavior:

  1. Update the app
  2. Launch the app

Expected behavior The app should launch

Log data Can't even open the app

marticliment commented 2 years ago

(P.S. Your app is freaking great, please keep up the good work!!!)

simon-knuth commented 2 years ago

Hi there, sorry to hear it doesn't work on Win10, that shouldn't happen. Could you please send me a log file from your log folder (assuming a log is being created fast enough)? The folder path is: %LocalAppData%\Packages\9390SimonKnuth.ScannerforWindows10_69n05hp4v3s90\RoamingState\logs

marticliment commented 2 years ago
{"Timestamp":"2021-12-02T14:29:50.0974847+01:00","Level":"Information","MessageTemplate":"--- Log initialized ---"}
{"Timestamp":"2021-12-02T14:29:50.0974847+01:00","Level":"Information","MessageTemplate":"App version: {0}","Properties":{"0":"3.0.1.0"}}
{"Timestamp":"2021-12-02T14:29:50.1431821+01:00","Level":"Information","MessageTemplate":"OS: {OS} | OS version: {Version} | OS architecture: {Architecture}","Properties":{"OS":"WINDOWS","Version":"10.0.19042.1237","Architecture":"X64"}}
{"Timestamp":"2021-12-02T14:29:50.1431821+01:00","Level":"Information","MessageTemplate":"Device family: {Family} | Device model: {Model} | Device manufacturer: {Manufacturer}","Properties":{"Family":"Windows.Desktop","Model":"81M9","Manufacturer":"LENOVO"}}
{"Timestamp":"2021-12-02T14:29:50.6601897+01:00","Level":"Information","MessageTemplate":"CheckScanSaveLocationDefaultAsync: Return True"}
{"Timestamp":"2021-12-02T14:29:50.7070711+01:00","Level":"Information","MessageTemplate":"AppDataService: Initialize"}

This is the full log, it does not (apparently) show any error.

P.S. i tried resetting the app, but it didn't help.

marticliment commented 2 years ago

I was wondering if it was missing some WinUI2.7 library to be installed on my computer, because I remember, when I installed MS Store (the Windows 11 Version) on my Windows 10 laptop i had to install some WinUI bundles and some C++ runtimes.

I' not really sure of this, but it could help you, idk.

simon-knuth commented 2 years ago

Alright, thank you for the log! :) While it didn't include helpful information on this issue, it showed that logging crashes doesn't work perfectly yet. It appears that the app crashes while initializing its many services and this part of the launch wasn't able to log issues. I improved this in version 3.0.2, which is now in the store, so it would be awesome if you could get a new log from that version so I can see exactly which part of the initialization fails.

marticliment commented 2 years ago

Hi @simon-knuth, i'm not home and i'm not going to be able to send you the log right now, i'll send it to you asap.

simon-knuth commented 2 years ago

No worries, that's no problem at all!

marticliment commented 2 years ago

Hi @simon-knuth,

{"Timestamp":"2021-12-08T11:07:37.7275227+01:00","Level":"Information","MessageTemplate":"--- Log initialized ---"}
{"Timestamp":"2021-12-08T11:07:37.7285395+01:00","Level":"Information","MessageTemplate":"App version: {0}","Properties":{"0":"3.0.2.0"}}
{"Timestamp":"2021-12-08T11:07:37.7597907+01:00","Level":"Information","MessageTemplate":"OS: {OS} | OS version: {Version} | OS architecture: {Architecture} | OS language: {Language}","Properties":{"OS":"WINDOWS","Version":"10.0.19042.1237","Architecture":"X64","Language":"ca-ES"}}
{"Timestamp":"2021-12-08T11:07:37.7597907+01:00","Level":"Information","MessageTemplate":"Device family: {Family} | Device model: {Model} | Device manufacturer: {Manufacturer}","Properties":{"Family":"Windows.Desktop","Model":"81M9","Manufacturer":"LENOVO"}}
{"Timestamp":"2021-12-08T11:07:38.0942085+01:00","Level":"Information","MessageTemplate":"CheckScanSaveLocationDefaultAsync: Return True"}
{"Timestamp":"2021-12-08T11:07:38.1343127+01:00","Level":"Information","MessageTemplate":"AppDataService: Initialize"}

Unfortunately, after upgrading to 3.0.2.0, app still crashes and the log still the same

simon-knuth commented 2 years ago

Thank you for checking this out again, I'm really surprised that nothing is showing up there 🤔 I guess I'll have to take a closer look at the entire app launch in hopes of being lucky and fixing this. I'm seeing a lot of crashes since the 3.0 update that happen during the launch and can't be investigated, so I'm definitely motivated to get this done.

I've already fixed a pretty severe potential issue for the next update, perhaps that's already it. Sorry that your efforts were in vain, but thanks again!

marticliment commented 2 years ago

Hi, just installed the latest update and the log shows as following:

{"Timestamp":"2021-12-21T16:22:42.7876126+01:00","Level":"Information","MessageTemplate":"--- Log initialized ---"}
{"Timestamp":"2021-12-21T16:22:42.7876126+01:00","Level":"Information","MessageTemplate":"App version: {0}","Properties":{"0":"3.0.4.0"}}
{"Timestamp":"2021-12-21T16:22:42.7876126+01:00","Level":"Information","MessageTemplate":"OS: {OS} | OS version: {Version} | OS architecture: {Architecture} | OS language: {Language}","Properties":{"OS":"WINDOWS","Version":"10.0.19042.1237","Architecture":"X64","Language":"ca-ES"}}
{"Timestamp":"2021-12-21T16:22:42.7876126+01:00","Level":"Information","MessageTemplate":"Device family: {Family} | Device model: {Model} | Device manufacturer: {Manufacturer}","Properties":{"Family":"Windows.Desktop","Model":"81M9","Manufacturer":"LENOVO"}}
{"Timestamp":"2021-12-21T16:22:42.8500923+01:00","Level":"Information","MessageTemplate":"Tracking error"}
{"Timestamp":"2021-12-21T16:22:42.8813307+01:00","Level":"Information","MessageTemplate":"CheckScanSaveLocationDefaultAsync: Return True"}
{"Timestamp":"2021-12-21T16:22:42.8971040+01:00","Level":"Information","MessageTemplate":"AppDataService: Initialize"}
{"Timestamp":"2021-12-21T16:22:43.3242870+01:00","Level":"Information","MessageTemplate":"Initialized temp folder"}
{"Timestamp":"2021-12-21T16:22:42.8981174+01:00","Level":"Fatal","MessageTemplate":"CRASH","Exception":"System.NullReferenceException: Object reference not set to an instance of an object.\r\n   at Scanner.Services.SettingsService.GetSetting(AppSetting) + 0x27f\r\n   at Scanner.Services.SettingsService.LogAllSettings() + 0xa2\r\n   at Scanner.App.<OnLaunched>d__4.MoveNext() + 0x203\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21\r\n   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e\r\n   at System.Action`1.Invoke(T) + 0x28\r\n   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33\r\n   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21\r\n   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8\r\n   at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24\r\n   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x3d\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21\r\n   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x75\r\n   at System.EventHandler`1.Invoke(Object, TEventArgs) + 0x2e\r\n   at __Interop.Intrinsics.HasThisCall__23[TArg0](Object, IntPtr, Object, TArg0) + 0x36\r\n   at Scanner!<BaseAddress>+0x192ef10\r\n","Properties":{"ExceptionDetail":{"Type":"System.NullReferenceException","HResult":-2147467261,"Message":"Object reference not set to an instance of an object.","Source":"<unknown>"}}}
simon-knuth commented 2 years ago

That's just awesome, thank you so much! Apparently the launch improvements in 3.0.3 fixed the early error logging and now I'm fairly certain I know what's going on here: Since your system language is set to ca-ES I suspect that your PC doesn't support OCR for any installed language, which I didn't consider.

In any case that method should never be able to crash the app, so I'll definitely get this fixed now. Thank you again, I never would have suspected that code to be the cause of those crashes. Hopefully that's finally gonna get rid of these crashes.

simon-knuth commented 2 years ago

Alright, v3.0.6 fixes multiple crashes and bugs that I discovered while testing with the Catalan language pack, and I really hope that I didn't miss anything. The new version is rolling out in small stages unless actively getting updates, but so far it looks promising.

In any case, thank you very much for your help - since no one with this issue can get to the GitHub link and reports aren't sent without the user first giving consent (which they also can't do), I couldn't have figured this out without your assistance!

marticliment commented 2 years ago

Thx mate, now it works! image

P.D. The new design looks great :)