[BUG] WhenActivated/WhenAnyObservable are throwing InvalidCastException in v12.1.1/v12.1.4
yjagota opened this issue · 1 comments
yjagota commented
Describe the bug
Any use of WhenActivated/WhenAnyObservable in any ReactiveObject is throwing the following exception:
System.InvalidCastException: Unable to cast object of type 'System.Object[]' to type 'ReactiveUI.IActivationForViewFetcher'.
at System.Runtime.CompilerServices.CastHelpers.ChkCastAny(Void* toTypeHnd, Object obj)
at System.Linq.Enumerable.<CastIterator>d__64`1.MoveNext()
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReactiveUI.ViewForMixins.<>c.<.cctor>b__1_0(Type t, Object _) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Activation\ViewForMixins.cs:line 24
at Splat.MemoizingMRUCache`2.Get(TParam key, Object context) in D:\a\splat\splat\src\Splat\MemoizingMRUCache.cs:line 138
at Splat.MemoizingMRUCache`2.Get(TParam key) in D:\a\splat\splat\src\Splat\MemoizingMRUCache.cs:line 114
at ReactiveUI.ViewForMixins.WhenActivated(IActivatableView item, Func`1 block, IViewFor view) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Activation\ViewForMixins.cs:line 149
at ReactiveUI.ViewForMixins.WhenActivated(IActivatableView item, Action`1 block, IViewFor view) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Activation\ViewForMixins.cs:line 226
at NovusPrime.Views.Controls.AuthorizationControl..ctor() in D:\Projects\Novus\NovusPrime\NovusPrime\Views\Controls\AuthorizationControl.xaml.cs:line 30
System.InvalidCastException: Unable to cast object of type 'System.Object[]' to type 'ReactiveUI.IActivationForViewFetcher'.
at System.Runtime.CompilerServices.CastHelpers.ChkCastAny(Void* toTypeHnd, Object obj)
at System.Linq.Enumerable.<CastIterator>d__64`1.MoveNext()
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReactiveUI.ReactiveNotifyPropertyChangedMixin.<>c.<.cctor>b__1_0(ValueTuple`3 t, Object _) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Mixins\ReactiveNotifyPropertyChangedMixin.cs:line 23
at Splat.MemoizingMRUCache`2.Get(TParam key, Object context) in D:\a\splat\splat\src\Splat\MemoizingMRUCache.cs:line 138
at Splat.MemoizingMRUCache`2.Get(TParam key) in D:\a\splat\splat\src\Splat\MemoizingMRUCache.cs:line 114
at ReactiveUI.ReactiveNotifyPropertyChangedMixin.NotifyForProperty(Object sender, Expression expression, Boolean beforeChange, Boolean suppressWarnings) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Mixins\ReactiveNotifyPropertyChangedMixin.cs:line 208
at ReactiveUI.ReactiveNotifyPropertyChangedMixin.NestedObservedChanges(Expression expression, IObservedChange`2 sourceChange, Boolean beforeChange, Boolean suppressWarnings) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Mixins\ReactiveNotifyPropertyChangedMixin.cs:line 189
at ReactiveUI.ReactiveNotifyPropertyChangedMixin.<>c__DisplayClass4_1`2.<SubscribeToExpressionChain>b__4(IObservedChange`2 y) in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Mixins\ReactiveNotifyPropertyChangedMixin.cs:line 152
at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:line 39
Steps To Reproduce:
- Create minimal application with ReactiveUI using WPF/.Net 5.0 with Splat.Autofac.
- In constructor of a ReactiveUserControl, try this.WhenActivated(d =>{});
Environment:
- OS: Windows 10 19042.110
- Net 5.0.8
- Splat.Autofac v12.1.1 or v12.1.4
- Autofac v6.2.0
Additional context
Works fine with Splat.Autofac v11.1.1
github-actions commented
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.