-
Notifications
You must be signed in to change notification settings - Fork 751
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
Rx.NET 6 preview 1 does not work with net7.0-windows #1889
Comments
Thank you! |
Does setting your For reasons that have yet to become clear to us, previous maintainers of Rx found it necessary to put a higher minimum Windows API version in the TFM for the target that supports WPF and Windows Forms. There are a bunch of complex problems here, and in the long run we're aiming to resolve that by putting those framework-specific parts into separate components, so in the long run, if you use Ideally we'd drop the requirement for 10.0.19041, but until I find out why the previous maintainers put that in, I can't just remove it. So it might be that for 6.0, the best we can do is improve the error message here. |
Yep that fixes the error. |
OK, so here's a bit more background on why this happened. Back in November 2020, @dotMorten added this commit: 415d91f I believe the purpose of that was to address the problem that loads of people building desktop apps were running into: they would add a reference to Rx and then be baffled that UI-framework support (e.g. The PR associated with that commit describes how @dotMorten was intending to address this: #1442 The thing I hadn't realised until today is that no version of Rx ever shipped with @dotMorten's change! I thought that in Rx.NET 6.0 preview.1 I was carefully reproducing the same behaviour Rx has had for the last two and a third years. But I've now realised that I've just given @dotMorten's change its first public outing! Also, things have moved on a bit since he submitted that change, meaning that my attempt to update the behaviour from .NET 5 to .NET 6 wasn't really sufficient. At the time he wrote that, there was only one version of .NET for which it was relevant: .NET 5. But now, both .NET 6 and .NET 7 have the issue that this change was meant to address, meaning that the error message it produces now needs cater for multiple versions of .NET. However, I'm now thinking that we probably don't want this feature: I think that it might cause a lot of problems for existing users. Here's what happens with today's Rx 5.0 package, with a variety of host application TFMs and developer intentions:
@dotMorten's change was designed to address the 3rd entry in that list, where the developer wants either WPF or Windows Forms features, but hasn't realised that they need to make their app target an OS-version-specific in order to get those features. Here's the situation after @dotMorten's change:
So it would fix the problem it aims to fix (3rd row in table). But it creates a new problem visible in row 2. With Rx 5.0 as it is today, developers targeting a Windows-specific TFM for a Windows API version older than 10.0.19041 (note that @dotMorten's change would remove that capability. Now this whole situation is a mess. The key issue here is the means by which you determine whether or not you get WPF and/or Windows Forms features. Back in Rx 3 this was determined by your choice of NuGet package references, but since Rx 4.0, it was based on which version of .NET you were targetting. My view is that with hindsight, that decision to move the WPF and Windows Forms functionality into the main So one of our goals for Rx 7.0 is to revert part of the "great unification" in which Rx 4.0 merged absolutely everything into a single So I'm currently thinking that our best bet for now is probably to back out @dotMorten's change because I think the 2nd table above is a worse situation than the first one. The first one is the status quo, so we won't be making anything worse. And I think the change to the 2nd row in the 2nd table could upset a lot of people. |
The first preview with this change is now up on NuGet as 6.0.0-preview.9. This gives us the following behaviours if you're on .NET 7 (and just substitute
|
Is there currently any way to target |
No. For one thing, an OS-specific TFM always implies a version, even if you don't write it explicitly. So Even if we take Rx out of the equation completely, it's not actually possible to specify a Windows-specific TFM without specifying a version number. You might haze specified it implicitly (by not saying the version number in the TFM) but you are nevertheless specifying a version number, even if you didn't realise that you were. There's a popular misconception that These are really weird statements when you say them out loud—it's hard to believe that anyone deliberately wants to make these very specific statements relating to a very old unsupported version of Windows, but that is what they're doing when they write just So, bearing in mind that you are always specifying a Windows version even if you don't say it out loud. The significance of the version number when it comes to Rx is that the Windows-specific target in Rx has a minimum version number. (I don't actually know why—that was set in a commit that has absolutely no explanation as to why that version number was chosen, the person who wrote it is not responding to enquiries about Rx, and I've not yet managed to work for myself out the logic behind it.) Rx's WPF/Windows Forms functionality doesn't work (or at least, claims not to work) on versions of Windows older than 10.0.19041, and so you don't get to use that functionality unless your code imposes a constraint that it must be running on 10.0.19041 or later. If you target just |
When installing
System.Reactive
version6.0.0-preview.1
either to a project that targetsnet7.0-windows
or to a class library that's referenced by another project targetingnet7.0-windows
, I get the following error:6.0.0-preview.1
Windows 10 22H2 19045.2673
dotnet CLI version 7.0.201
Applications with an OS-specific TFM (like a windows desktop app)
.NET 7 apps with an OS-specific TFM using Rx 6 should build successfully
Build fails
Set up a new console app (using
--target-framework-override
for the sake of example but the same occurs if you manually change the TFM via Visual Studio or editing the csproj):Then install Rx 6 preview 1:
Build fails with the aforementioned error.
The text was updated successfully, but these errors were encountered: