-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
In version 9.14.1, in commit [a1cb284] MSBuild.Sdk.Extras was updated to v2.0.24 (from 1.6.68). Also ExtrasEnableWpfProjectSetup tag is changed to UseWpf.
After these two changes in WPF project, WhenActivated event does not fire when loaded into ViewModelViewHost.
When MSBuild.Sdk.Extras is rolled back to version 1.6.68 and UseWpf changed back to ExtrasEnableWpfProjectSetup in ReactiveUI.Wpf/ReactiveUI.Wpf.csproj then everything works again, i.e. this.WhenActivated in view loaded into ViewModelViewHost fires again.
Steps To Reproduce
In attached simple WPF project (DebugWhenActivated.zip):
- In App.xaml.css add:
Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly()); - In
MainWindow.xamladdViewModelViewHost - In MainWindow.xaml.cs bind
ViewModelViewHost.ViewModelwithMainDocViewModelwhich isViewModelforMainDocView.xaml(Reactive)UserControl
Expected behavior
ViewModelViewHostloadsMainDocView.xaml- In
MainDocView.xaml.csconstructorthis.WhenActivatedis fired
Actual behavior
- The same
this.WhenActivatedis not fired
Environment
- OS: Windows 10
- Version 1809
- Device: PC laptop
- IDE: Visual Studio 2019 Enterprise
Additional context
To investigate issue, I have added ReactiveUI and ReactiveUI.Wpf as projects dependencies to my test app (DebugWhenActivated). I had to remove most targets from ReactiveUI.csproj to be able to compile project.
You can get the same result if you add dependency via NuGet: Version 9.13.1 works ok and in 9.14.1 this.WhenActivated does not work if loaded into ViewModelViewHost.