Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Critical] Continuous ReactiveCommand crash - TypeLoadException #3123

Closed
ccornici opened this issue Dec 23, 2021 · 3 comments
Closed
Labels

Comments

@ccornici
Copy link

ccornici commented Dec 23, 2021

Describe the bug

THIS IS FIXED BY DOWNGRADING PACKAGES TO 13.3.2

  • that's the other "latest" version that I use in some other app, which had no such problem.

So...the bug:

I've got a Command

public ReactiveCommand<string, Unit> Cmd { get; }
......
            // In ctor
            Cmd = ReactiveCommand.CreateFromTask<string>((id) =>
            {
                return SomeAsyncMethod(id);
            });
System.TypeInitializationException: 'The type initializer for 'ReactiveUI.RxApp' threw an exception.'
TypeLoadException: Could not load type 'ReactiveUI.ComponentModelTypeConverter' from assembly 'ReactiveUI, Version=17.1.0.0, Culture=neutral, PublicKeyToken=null'.
   at ReactiveUI.RxApp.get_MainThreadScheduler() in /_/src/ReactiveUI/RxApp.cs:line 146
   at ReactiveUI.ReactiveCommand`2..ctor(Func`2 execute, IObservable`1 canExecute, IScheduler outputScheduler) in /_/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs:line 657
   at ReactiveUI.ReactiveCommand.CreateFromObservable[TParam,TResult](Func`2 execute, IObservable`1 canExecute, IScheduler outputScheduler) in /_/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs:line 340
   at ReactiveUI.ReactiveCommand.CreateFromTask[TParam](Func`2 execute, IObservable`1 canExecute, IScheduler outputScheduler) in /_/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs:line 566
   at MyApp.ViewModels.InventoryVM..ctor(IStorageService storageService) in C:\Projects\Win 10 apps\MyApp\MyApp\ViewModels\InventoryVM.cs:line 18
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at MyApp.Framework.ViewModelLocator.get_InventoryVM() in C:\Projects\Win 10 apps\MyApp\MyApp\Framework\ViewModelLocator.cs:line 12
   at MyApp.Views.InventoryPage..ctor() in C:\Projects\Win 10 apps\MyApp\MyApp\Views\InventoryPage.xaml.cs:line 14

Steps To Reproduce

See above, it's a command!

Expected behaviour

Not crash maybe? Idk

Screenshots

image

Environment

  • OS: Glorious Win 10
  • Version 10.0.19043 Build 19043
  • Device: Nokia 3310
  • ReactiveUI Version: 17.1.9, Fody & WPF

Additional context

THIS IS FIXED BY DOWNGRADING PACKAGES TO 13.3.2
Using .net core 3.1

@ChrisPulman
Copy link
Member

ChrisPulman commented Dec 23, 2021

Again please look at this https://github.com/ChrisPulman/reactive_ui_bug_1 it will help you understand the issue you are experiencing

GitHub
Contribute to ChrisPulman/reactive_ui_bug_1 development by creating an account on GitHub.

@ChrisPulman
Copy link
Member

ChrisPulman commented Dec 23, 2021

For your information and as per the release notes and targets published with the nuget package V16.x.x was the last version that supports netcoreapp3.1 and net5.0, please migrate to net6.0 to use V17.
As per the issue raised in one of the libraries you have attempted to include it only supports up to net48 - rafallopatka/ToastNotifications#109

Correcting the coding method and excluding this library allows the application to operate as expected.
Please read our documentation for guidance on the correct way to code your application
https://www.reactiveui.net/docs/handbook/

@github-actions
Copy link

github-actions bot commented Jan 7, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants