-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug 🐞
I just updated all NuGet packages in my Avalonia desktop application, and I am getting a TypeLoadException in BuildAvaloniaApp now from ReactiveUI:
System.TypeInitializationException: 'The type initializer for 'ReactiveUI.RxApp' threw an exception.'
Inner Exception
TypeLoadException: Could not load type 'Splat.ExceptionMixins' from assembly 'Splat.Core, Version=19.2.0.0, Culture=neutral, PublicKeyToken=null'.
This is occurring on my call to InitializeReactiveUI:
// In Program.cs, BuildAvaloniaApp
var builder = new ContainerBuilder(); // Autofac.ContainerBuilder
var resolver = builder.UseAutofacDependencyResolver(); // From Splat.Autofac.SplatAutofacExtensions
// Crashes here:
resolver.InitializeReactiveUI(); // From ReactiveUI.DependencyResolverMixinsI can fix this by manually installing an older version of Splat.Autofac - versions up to and including 17.2.1 work, but 18.1.1 and up are broken. The version of Splat.Core mentioned in the exception is different depending on what version is installed - 18.1.1 produces from assembly 'Splat.Core, Version=18.1.0.0, for instance. These all seem to correspond with assembly versions that do not have a matching package version on NuGet.
I'm not sure if this is the fault of ReactiveUI or Splat, but given that the stack trace is coming from ReactiveUI, I decided to start here.
Step to reproduce
- Clone the reproduction repo and build.
- Ensure the application launches.
- Update project's Splat.Autofac dependency to any newer version, such as the latest 19.2.1.
- Attempt to launch the application again, and observe that it crashes early during initialization.
Reproduction repository
https://github.com/ArcanoxDragon/ReactiveUiSplatRepro
Expected behavior
Using the latest versions of ReactiveUI/Splat/Autofac together should not cause exceptions on application launch. ReactiveUI should not attempt to load types from an assembly version that does not exist on NuGet.
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows 10 x64
Version
22H2
Device
No response
ReactiveUI Version
22.2.1
Additional information ℹ️
No response