-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
--SEE SECOND COMMENT--
Describe the bug
I'm trying to test a project using the latest preview of NET6. When I launch my WPF project that uses RxUI, it crashes with the error:
System.TypeInitializationException: 'The type initializer for 'ReactiveUI.RxApp' threw an exception.'
TypeLoadException: Could not load type 'System.Reactive.Concurrency.DispatcherScheduler' from assembly 'ReactiveUI, Version=15.1.0.0, Culture=neutral, PublicKeyToken=null'.
I did some investigation and it appears as the HAS_WPF flag in ReactiveUI.csproj is limited to net5.0-windows:
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net46')) or $(TargetFramework) == 'net47' or $(TargetFramework) == 'net471' or $(TargetFramework) == 'net5.0-windows'">
<DefineConstants>$(DefineConstants);HAS_WPF</DefineConstants>
</PropertyGroup>
... and since HAS_WFP evaluates to false, it fails to create the dispatcher as expected.
I cloned the source and added net6.0-windows to the condition, built a test version, and it still failed. However, when I changed the <targetframework> in my csproj...
from: `<TargetFramework>net6.0-windows</TargetFramework>`
to: `<TargetFramework>net6.0-windows10.0.19041</TargetFramework>`
...everything works fine. I'm not sure why that is though. It was a shot in the dark based on some advice given on here to people during the migration from netcore 3.1 to NET5.0
Steps To Reproduce
Provide the steps to reproduce the behavior:
- Create a NET6.0 WPF project with RxUI
- Use something via RxApp (i.e.
RxApp.SuppressViewCommandBindingMessage = true) - See error
Expected behavior
Run correctly on NET6 WPF instead of only NET6 MAUI (I think?).
Environment
- OS: Windows 10 Enterprise 20H2
- Version RxUI 15.1.1