microsoft / appcenter-sdk-dotnet

Development repository for the App Center SDK for .NET platforms, including Xamarin
Other
310 stars 141 forks source link

System.TypeInitializationException: The type initializer for 'Microsoft.AppCenter.Utils.ApplicationLifecycleHelperDesktop' threw an exception. #1709

Closed tmccowan closed 8 months ago

tmccowan commented 1 year ago

Description

I recently updated our WPF application which runs on Windows 7 (not a personal choice) and Windows 10 from the following: net6.0 self-contained Microsoft.AppCenter.Crashes 4.5.3 Microsoft.AppCenter.Analytics 4.5.3

to: net7.0 self-contained Microsoft.AppCenter.Crashes 5.0.1 Microsoft.AppCenter.Analytics 5.0.1

After updating the framework and nuget packages the application started crashing on Windows 7, but continues to work on Windows 10. The application immediately crashes in the OnStartup method.

Details

Platform: Windows 7 (problem) Windows 10 (no problem)

I captured this stacktrace from a screenshot on my phone. I tried to fix the OCR failures.

System.TypeInitialization Exception: The type initializer for 'Microsoft.AppCenter.Utils.ApplicationLifecycleHelperDesktop' threw an exception. ---> System.TypeInitialization Exception: The type initializer for 'Microsoft.AppCenter. Utils. WindowsHelper' threw an exception. -> System.EntryPointNotFoundException: Unable to find an entry point named 'GetCurrentPackageFullName' in DLL 'kernel32.dll. at Microsoft.AppCenter.Utils.WindowsHelper.GetCurrentPackageFulIName(Int32& packageFullNameLength, StringBuilder packageFullName) at Microsoft.AppCenter.Utils. WindowsHelper. _IsRunningAsUwp() Microsoft.AppCenter.Utils.WindowsHelper.cctor0 -- End of inner exception stack trace -- at Microsoft.AppCenter.Utils.WindowsHelper.add_OnMinimized(WinEventDelegate value) at Microsoft.AppCenter.Utils.ApplicationLifecycleHelperDesktop.ctorO --- End of inner exception stack trace -- at Microsoft.AppCenter.Utils.ApplicationLifecycleHelperDesktop-ctori at Microsoft.AppCenter.ApplicationLifecycleHelperget Instance at Microsoft.AppCenter.AppCenter.ctor| at Microsoft.AppCenter.AppCenter.get Instance at Microsoft.AppCenter.AppCenter.PlatformStart(String appSecret, Typell services) at Microsoft.AppCenter.AppCenter.Start(String appSecret, Typell services) at ......App.OnStartup(StartupEventArgs e) in D:\a\1\s\Projects......\App.xaml.cs:line 174 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)

AnatolyPristensky commented 1 year ago

Hello @tmccowan, thank you for your contribution! We will test it and update this thread accordingly.

DmitriyKirakosyan commented 8 months ago

Closing as the fix was released.