I tried reproducing your issue and I only managed to reproduce it while debugging it:
- Even if
AppUser.ExistAuthData
was the first call inApp
constructor, it worked fine as long as I didn't put any breakpoints before the call. - If I put the breakpoint before the call and hovered over the
AppUser.ExistAuthData
property, I managed to reproduce your error with the exact same stack trace.
The reason seems to be that if you try to initialize LocalSettings
(first call) while the main thread is stopped, it throws an exception (you can see that even in the debugger tooltip). As soon as this happens, there's no way to use AppUser
class any more, because the exception was thrown from its static constructor which is called only a single time and rethrows the same exception at any future attempt to acces it. I've already blogged about this behavior years ago.
If you access LocalSettings
before that call, you have already initialized it, making sure future attempts to access it don't fail even if the main thread is stopped. This way, everything works fine even if you hover over the property in the debugger.