You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an application targeting 4.8, which uses ReactiveUI.WPF 18.4.1 net48 referencing ReactiveUI 18.4.1 net472, in turn referencing System.Reactive 5.0.0. The dll comes from the nuget net472 lib. This works well.
However, some of our clients are using a third party program which puts System.Reactive targeting netstandard2.0 in their GAC.
When loading the dll in their environment, the dll from the GAC is prioritized over our dll, which causes a crash since DispatcherScheduler.Current doesn't exist in the netstandard2.0 dll of System.Reactive (https://github.com/reactiveui/ReactiveUI/blob/main/src/ReactiveUI.Wpf/Registrations.cs#L40)
Unhandled Exception: System.TypeInitializationException: The type initializer for 'ReactiveUI.RxApp' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Reactive.Concurrency.DispatcherScheduler' from assembly 'System.Reactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'.
at ReactiveUI.Wpf.Registrations.<>c.<Register>b__0_10()
at ReactiveUI.WaitForDispatcherScheduler.AttemptToCreateScheduler() in /_/src/ReactiveUI/Scheduler/WaitForDispatcherScheduler.cs:line 61
at ReactiveUI.WaitForDispatcherScheduler..ctor(Func`1 schedulerFactory) in /_/src/ReactiveUI/Scheduler/WaitForDispatcherScheduler.cs:line 34
at ReactiveUI.Wpf.Registrations.Register(Action`2 registerFunction) in /_/src/ReactiveUI.Wpf/Registrations.cs:line 40
at ReactiveUI.DependencyResolverMixins.ProcessRegistrationForNamespace(String namespaceName, AssemblyName assemblyName, IMutableDependencyResolver resolver) in /_/src/ReactiveUI/Mixins/DependencyResolverMixins.cs:line 153
at ReactiveUI.DependencyResolverMixins.InitializeReactiveUI(IMutableDependencyResolver resolver, RegistrationNamespace[] registrationNamespaces) in /_/src/ReactiveUI/Mixins/DependencyResolverMixins.cs:line 74
at ReactiveUI.RxApp.<>c.<.cctor>b__9_0() in /_/src/ReactiveUI/RxApp.cs:line 92
at Splat.InternalLocator.RegisterResolverCallbackChanged(Action callback) in /_/src/Splat/ServiceLocation/InternalLocator.cs:line 117
at Splat.Locator.RegisterResolverCallbackChanged(Action callback) in /_/src/Splat/ServiceLocation/Locator.cs:line 81
at ReactiveUI.RxApp..cctor() in /_/src/ReactiveUI/RxApp.cs:line 85
--- End of inner exception stack trace ---
at ReactiveUI.RxApp.get_MainThreadScheduler()
at WpfApplication1.ExceptionService.Initialize() in C:\Users\reyan\RiderProjects\WpfApplication1\WpfApplication1\App.xaml.cs:line 24
at WpfApplication1.App.OnStartup(StartupEventArgs e) in C:\Users\reyan\RiderProjects\WpfApplication1\WpfApplication1\App.xaml.cs:line 15
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)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
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)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at WpfApplication1.App.Main()
Here is a light reproduction solution (you have to add the included System.Reactive to your GAC). WpfApplication1.zip
We know this isn't a bug in reactiveUI, which is why we aren't opening an issue, but we've searched far and wide and we're really stumped with this issue, so any help is very welcome even if it's just telling us to ask somewhere else (where else?).
What should we do here? Right now we've upgraded to a newer version of ReactiveUI referencing System.Reactive 6.0.0, but what can we do if someone adds it to the GAC again?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have an application targeting 4.8, which uses ReactiveUI.WPF 18.4.1 net48 referencing ReactiveUI 18.4.1 net472, in turn referencing System.Reactive 5.0.0. The dll comes from the nuget net472 lib. This works well.
However, some of our clients are using a third party program which puts System.Reactive targeting netstandard2.0 in their GAC.
When loading the dll in their environment, the dll from the GAC is prioritized over our dll, which causes a crash since DispatcherScheduler.Current doesn't exist in the netstandard2.0 dll of System.Reactive (https://github.com/reactiveui/ReactiveUI/blob/main/src/ReactiveUI.Wpf/Registrations.cs#L40)
Here is a light reproduction solution (you have to add the included System.Reactive to your GAC).
WpfApplication1.zip
We know this isn't a bug in reactiveUI, which is why we aren't opening an issue, but we've searched far and wide and we're really stumped with this issue, so any help is very welcome even if it's just telling us to ask somewhere else (where else?).
What should we do here? Right now we've upgraded to a newer version of ReactiveUI referencing System.Reactive 6.0.0, but what can we do if someone adds it to the GAC again?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions