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] Unit testing .NET Core WPF applications fails with TypeLoadException #2194

anaisbetts opened this issue Oct 4, 2019 · 1 comment · Fixed by #2195


Copy link

@anaisbetts anaisbetts commented Oct 4, 2019

Describe the bug

Unit testing .NET Core WPF apps doesn't work because getting MainThreadScheduler blows up even though we're in a test runner.

    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=, Culture=neutral, PublicKeyToken=94bc3704cddfc263'.
  Stack Trace: 
    RxApp.get_MainThreadScheduler() line 138
    MainWindowViewModel.ctor(IObservable`1 allAppWindows) line 49
    SmokeTests.MainWindowViewModelShouldBeCreatableInRunner() line 13
    ----- Inner Stack Trace -----
    WaitForDispatcherScheduler.AttemptToCreateScheduler() line 67
    WaitForDispatcherScheduler.ctor(Func`1 schedulerFactory) line 35
    Registrations.Register(Action`2 registerFunction) line 37
    DependencyResolverMixins.ProcessRegistrationForNamespace(String ns, AssemblyName assemblyName, IMutableDependencyResolver resolver) line 120
    <>c__DisplayClass0_0.<InitializeReactiveUI>b__2(String ns) line 47
    CompatMixins.ForEach[T](IEnumerable`1 this, Action`1 block) line 16
    DependencyResolverMixins.InitializeReactiveUI(IMutableDependencyResolver resolver) line 48
    <.cctor>b__9_0() line 87
    InternalLocator.RegisterResolverCallbackChanged(Action callback) line 120
    Locator.RegisterResolverCallbackChanged(Action callback) line 74
    RxApp.cctor() line 89
@anaisbetts anaisbetts added the bug label Oct 4, 2019

This comment has been minimized.

Copy link

@open-collective-bot open-collective-bot bot commented Oct 4, 2019

Hey @anaisbetts 👋,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.

PS.: We offer priority support for all financial contributors. Don't forget to add priority label once you start contributing 😄

An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
anaisbetts added a commit that referenced this issue Oct 4, 2019
glennawatson added a commit that referenced this issue Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.