chocolatey / chocolatey/ChocolateyGUI
#crash System.TypeInitializationException
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 272
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 1
Description
I cannot launch the app on windows 11, it crashes creating a memory dump
I get this error message:
>Unable to load Chocolatey GUI assembly. The type initializer for 'ChocolateyGui.Common.Windows.Bootstrapper' threw an exception.
opening the crash dump i get the following:
the exception source is App.xaml.cs line 105:
` var splashScreenService = Bootstrapper.Container.Resolve();
`
>'The type initializer for 'ChocolateyGui.Common.Windows.Bootstrapper' threw an exception.'
ArgumentNullException: Value cannot be null.
>This exception was originally thrown at this call stack:
Autofac.ResolutionExtensions.ResolveService(Autofac.IComponentContext, Autofac.Core.Service, System.Collections.Generic.IEnumerable)
ChocolateyGui.Common.Windows.Theming.ThemeAssist.ThemeAssist() in ThemeAssist.cs
Running the cli
```
PS C:\Windows\system32> chocolateyguicli.exe
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'chocolatey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb' or one of its dependencies. Uncaught exception during type initialization. (Exception from HRESULT: 0x80131534) ---> System.TypeInitializationException: The type initializer for 'ChocolateyGuiCli.Bootstrapper' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'chocolatey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER)) ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ChocolateyGuiCli.Program.<>c.b__2_0(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
--- End of inner exception stack trace ---
at ChocolateyGuiCli.Bootstrapper..cctor()
--- End of inner exception stack trace ---
at ChocolateyGuiCli.Bootstrapper.get_Logger()
at ChocolateyGuiCli.Program.<>c.b__2_0(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
--- End of inner exception stack trace ---
at ChocolateyGuiCli.Runner.Run(String[] args)
at ChocolateyGuiCli.Program.Main(String[] args)
```
Contributor guide
Research direction
Start by reproducing the Windows 11 launch failure and CLI failure, then inspect App.xaml.cs at line 105, ThemeAssist.cs, and the AddAssemblyResolver handler in Program. Confirm the cause of the type-initialization and assembly-loading exceptions, and consider the issue complete when both the GUI and CLI launch without these crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100