diff --git a/Rx.NET/Integration/LinuxTests/LinuxTests.csproj b/Rx.NET/Integration/LinuxTests/LinuxTests.csproj index 585b989f12..a898655ed6 100644 --- a/Rx.NET/Integration/LinuxTests/LinuxTests.csproj +++ b/Rx.NET/Integration/LinuxTests/LinuxTests.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1;netcoreapp2.1;net5.0 + net6.0;net7.0 $(NoWarn);CS0618 latest Tests.System.Reactive @@ -9,10 +9,10 @@ ..\..\Source\ReactiveX.snk - + $(DefineConstants); - + $(DefineConstants);LINUX diff --git a/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj b/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj index 3cab48abef..60e8782a80 100644 --- a/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj +++ b/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj @@ -1,6 +1,6 @@  - net5.0;net5.0-windows10.0.19041 + net6.0;net6.0-windows10.0.19041;net7.0;net7.0-windows10.0.19041 $(NoWarn);CS0618 latest Tests.System.Reactive @@ -9,13 +9,8 @@ ..\..\Source\ReactiveX.snk - - true - true - $(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR - - - true + + true true $(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT diff --git a/Rx.NET/Source/Directory.build.props b/Rx.NET/Source/Directory.build.props index 364b42e270..2e16b5d1c9 100644 --- a/Rx.NET/Source/Directory.build.props +++ b/Rx.NET/Source/Directory.build.props @@ -20,6 +20,10 @@ true true latest + + + 5-Default + $(NoWarn);CS8600;CS8602;CS8603;CS8604;CS8632;CA1000;CA1003;CA1014;CA1019;CA1033;CA1045;CA1051;CA1052;CA1063;CA1067;CA1068;CA1507;CA1707;CA1711;CA1716;CA1720;CA1806;CA1815;CA1816;CA1822;CA1825;CA1840;CA1845;CA2016;CA2109;CA2201;CA2211;CA2213;CA2249;IDE0003;IDE0016;IDE0017;IDE0018;IDE0019;IDE0020;IDE0031;IDE0032;IDE0034;IDE0037;IDE0038;IDE0039;IDE0040;IDE0044;IDE0051;IDE0052;IDE0056;IDE0057;IDE0059;IDE0060;IDE0062;IDE0063;IDE0071;IDE0074;IDE0075;IDE0076;IDE0077;IDE0079;IDE0083;IDE0090;IDE0180;IDE0270;IDE0280;IDE1006;IDE1056 diff --git a/Rx.NET/Source/Directory.build.targets b/Rx.NET/Source/Directory.build.targets index 6b2ec3af9e..268dcf92ec 100644 --- a/Rx.NET/Source/Directory.build.targets +++ b/Rx.NET/Source/Directory.build.targets @@ -9,26 +9,18 @@ $(DefineConstants);HAS_WINFORMS;HAS_WPF;HAS_WINRT;HAS_DISPATCHER;HAS_REMOTING;DESKTOPCLR;NO_NULLABLE_ATTRIBUTES - - 10.0.19041.0 - 10.0.15063.0 - $(DefineConstants);HAS_WINRT;NO_CODE_COVERAGE_ATTRIBUTE;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;NO_TRACE;WINDOWS;NO_NULLABLE_ATTRIBUTES - - + $(DefineConstants);HAS_WINRT;WINDOWS;HAS_OS_XAML;LEGACY_WINRT;NO_NULLABLE_ATTRIBUTES 10.0.19041.0 - + $(DefineConstants);HAS_WINRT;NO_NULLABLE_ATTRIBUTES - - $(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR - - + $(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT - + diff --git a/Rx.NET/Source/facades/System.Reactive.Core/System.Reactive.Core.csproj b/Rx.NET/Source/facades/System.Reactive.Core/System.Reactive.Core.csproj index cdc41a17b0..b6f620e680 100644 --- a/Rx.NET/Source/facades/System.Reactive.Core/System.Reactive.Core.csproj +++ b/Rx.NET/Source/facades/System.Reactive.Core/System.Reactive.Core.csproj @@ -1,7 +1,7 @@  - net472;netstandard2.0;uap10.0.16299 + net472;netstandard2.0;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj b/Rx.NET/Source/facades/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj index cdc41a17b0..b6f620e680 100644 --- a/Rx.NET/Source/facades/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj +++ b/Rx.NET/Source/facades/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj @@ -1,7 +1,7 @@  - net472;netstandard2.0;uap10.0.16299 + net472;netstandard2.0;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.Linq/System.Reactive.Linq.csproj b/Rx.NET/Source/facades/System.Reactive.Linq/System.Reactive.Linq.csproj index cdc41a17b0..b6f620e680 100644 --- a/Rx.NET/Source/facades/System.Reactive.Linq/System.Reactive.Linq.csproj +++ b/Rx.NET/Source/facades/System.Reactive.Linq/System.Reactive.Linq.csproj @@ -1,7 +1,7 @@  - net472;netstandard2.0;uap10.0.16299 + net472;netstandard2.0;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj b/Rx.NET/Source/facades/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj index cdc41a17b0..b6f620e680 100644 --- a/Rx.NET/Source/facades/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj +++ b/Rx.NET/Source/facades/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj @@ -1,7 +1,7 @@  - net472;netstandard2.0;uap10.0.16299 + net472;netstandard2.0;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.Providers/System.Reactive.Providers.csproj b/Rx.NET/Source/facades/System.Reactive.Providers/System.Reactive.Providers.csproj index cdc41a17b0..b6f620e680 100644 --- a/Rx.NET/Source/facades/System.Reactive.Providers/System.Reactive.Providers.csproj +++ b/Rx.NET/Source/facades/System.Reactive.Providers/System.Reactive.Providers.csproj @@ -1,7 +1,7 @@  - net472;netstandard2.0;uap10.0.16299 + net472;netstandard2.0;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj b/Rx.NET/Source/facades/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj index eadbee9578..366145a8c4 100644 --- a/Rx.NET/Source/facades/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj +++ b/Rx.NET/Source/facades/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj @@ -1,7 +1,7 @@  - net472;uap10.0.16299 + net472;uap10.0.18362 diff --git a/Rx.NET/Source/facades/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj b/Rx.NET/Source/facades/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj index b0cba99dee..0be1f2b00e 100644 --- a/Rx.NET/Source/facades/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj +++ b/Rx.NET/Source/facades/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj @@ -1,7 +1,7 @@  - uap10.0.16299 + uap10.0.18362 diff --git a/Rx.NET/Source/src/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj b/Rx.NET/Source/src/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj index dc14fc868a..f735fad7db 100644 --- a/Rx.NET/Source/src/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj +++ b/Rx.NET/Source/src/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1;net472;uap10.0.16299;netstandard2.0;net5.0 + netstandard2.0;net472;uap10.0.18362;net6.0 false Reactive Extensions Testing Library containing interfaces and classes providing functionality to test applications and libraries built using Reactive Extensions. Microsoft.Reactive.Testing - Testing Helper Library diff --git a/Rx.NET/Source/src/System.Reactive.Observable.Aliases/System.Reactive.Observable.Aliases.csproj b/Rx.NET/Source/src/System.Reactive.Observable.Aliases/System.Reactive.Observable.Aliases.csproj index 30ac64cfce..e88c136270 100644 --- a/Rx.NET/Source/src/System.Reactive.Observable.Aliases/System.Reactive.Observable.Aliases.csproj +++ b/Rx.NET/Source/src/System.Reactive.Observable.Aliases/System.Reactive.Observable.Aliases.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net472;uap10.0.16299;net5.0 + netstandard2.0;net472;uap10.0.18362;net6.0 Reactive Extensions - Aliases false Rx;Reactive;Extensions;Observable;LINQ;Events diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs b/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs index a98ac7b423..d913ead511 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs @@ -5,10 +5,6 @@ using System.Globalization; using System.Reflection; -#if HAS_WINRT -using System.Runtime.InteropServices.WindowsRuntime; -#endif - namespace System.Reactive { internal static class ReflectionUtils @@ -76,18 +72,16 @@ public static void GetEventMethods(Type targetType, object? isWinRT = false; -#if HAS_WINRT && !CSWINRT - if (addMethod.ReturnType == typeof(EventRegistrationToken)) + if (IsWinRTEventRegistrationTokenType(addMethod.ReturnType)) { isWinRT = true; var pet = psr[0]; - if (pet.ParameterType != typeof(EventRegistrationToken)) + if (IsWinRTEventRegistrationTokenType(pet.ParameterType)) { throw new InvalidOperationException(Strings_Linq.EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT); } } -#endif delegateType = psa[0].ParameterType; @@ -119,5 +113,42 @@ public static void GetEventMethods(Type targetType, object? #if (CRIPPLED_REFLECTION && HAS_WINRT) public static MethodInfo GetMethod(this Type type, string name) => type.GetTypeInfo().GetDeclaredMethod(name); #endif + + /// + /// Determine whether a type represents a WinRT event registration token + /// (https://learn.microsoft.com/en-us/uwp/api/windows.foundation.eventregistrationtoken). + /// + /// The type to check. + /// True if this represents a WinRT event registration token + /// + /// + /// We used to perform a simple comparison with typeof(EventRegistrationToken), but the + /// introduction of C#/WinRT has made this problematic. Before C#/WinRT, the .NET + /// projection of WinRT's Windows.Foundation.EventRegistrationToken type was + /// System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken. But that type is + /// associated with the old WinRT interop mechanisms in which the CLR works directly with + /// WinMD. That was how it worked up as far as .NET Core 3.1, and it's still how .NET + /// Framework works, but this direct WinMD support was removed in .NET 5.0. + /// + /// + /// If you're on .NET 5.0 or later, the System.Runtime.InteropServices.WindowsRuntime types + /// are no longer supported. While you can still get access to them through the NuGet + /// package of the same name (that's how .NET Standard 2.0 libraries are able to use these + /// types) they are best avoided, because the types in that library are no longer the types + /// you see when any of the WinRT types they are meant to represent are projected into the + /// CLR's world. + /// + /// + /// It was therefore necessary for Rx to stop using these types, and to drop its reference + /// to the System.Runtime.InteropServices.WindowsRuntime package. We can replicate the + /// same logic by looking for the type name. By checking for either the old or new + /// namespaces, we can support both the old projection (still used on .NET Framework) and + /// also the new C#/WinRT projection. + /// + /// + private static bool IsWinRTEventRegistrationTokenType(Type t) => + t.Name == "EventRegistrationToken" && + (t.Namespace == "System.Runtime.InteropServices.WindowsRuntime" || + t.Namespace == "WinRT"); } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs index 16ee7bb9be..f5b6110ae1 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/FromEventPattern.cs @@ -69,18 +69,12 @@ public sealed class Handler : EventProducer _getResult; -#if HAS_WINRT private readonly bool _isWinRT; -#endif public Handler(object? target, Type delegateType, MethodInfo addMethod, MethodInfo removeMethod, Func getResult, bool isWinRT, IScheduler scheduler) : base(scheduler) { -#if HAS_WINRT _isWinRT = isWinRT; -#else - System.Diagnostics.Debug.Assert(!isWinRT); -#endif _target = target; _delegateType = delegateType; _addMethod = addMethod; @@ -100,13 +94,11 @@ protected override IDisposable AddHandler(Delegate handler) try { -#if HAS_WINRT if (_isWinRT) { removeHandler = AddHandlerCoreWinRT(handler); } else -#endif { removeHandler = AddHandlerCore(handler); } @@ -147,13 +139,11 @@ private Action AddHandlerCore(Delegate handler) return () => _removeMethod.Invoke(_target, new object[] { handler }); } -#if HAS_WINRT private Action AddHandlerCoreWinRT(Delegate handler) { var token = _addMethod.Invoke(_target, new object[] { handler }); return () => _removeMethod.Invoke(_target, new[] { token }); } -#endif } } } diff --git a/Rx.NET/Source/src/System.Reactive/System.Reactive.csproj b/Rx.NET/Source/src/System.Reactive/System.Reactive.csproj index dac82bde1a..7f52ed30bd 100644 --- a/Rx.NET/Source/src/System.Reactive/System.Reactive.csproj +++ b/Rx.NET/Source/src/System.Reactive/System.Reactive.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1;netstandard2.0;net472;uap10.0.16299;net5.0;net5.0-windows10.0.19041 + netstandard2.0;net472;uap10.0.18362;net6.0;net6.0-windows10.0.19041 false Rx;Reactive;Extensions;Observable;LINQ;Events Reactive Extensions (Rx) for .NET @@ -10,16 +10,11 @@ enable - + true true - false - - - - @@ -36,23 +31,13 @@ - - - - - - - - - - - + - + @@ -64,7 +49,7 @@ - + @@ -159,36 +144,10 @@ - - $(TargetsForTfmSpecificBuildOutput);RemoveNetCoreApp3FromNuGet - $(TargetsForTfmSpecificContentInPackage);AddNetCore3ToNuGet - - - - - - - - - - - - - - - - - - - - - - - - - - + + + True True diff --git a/Rx.NET/Source/src/System.Reactive/build/System.Reactive.net5.0-windows.targets b/Rx.NET/Source/src/System.Reactive/build/System.Reactive.net6.0-windows.targets similarity index 84% rename from Rx.NET/Source/src/System.Reactive/build/System.Reactive.net5.0-windows.targets rename to Rx.NET/Source/src/System.Reactive/build/System.Reactive.net6.0-windows.targets index b3e5a9dc2d..f8dce4a36b 100644 --- a/Rx.NET/Source/src/System.Reactive/build/System.Reactive.net5.0-windows.targets +++ b/Rx.NET/Source/src/System.Reactive/build/System.Reactive.net6.0-windows.targets @@ -3,7 +3,7 @@ + Text = "The 'System.Reactive' nuget package cannot be used to target '$(TargetFramework)'. Target 'net6.0-windows10.0.19041' or later instead." /> diff --git a/Rx.NET/Source/src/System.Reactive/build/System.Reactive.targets b/Rx.NET/Source/src/System.Reactive/build/System.Reactive.targets deleted file mode 100644 index 2452a8e5eb..0000000000 --- a/Rx.NET/Source/src/System.Reactive/build/System.Reactive.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - true - false - - - - - - - - diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Package.appxmanifest b/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Package.appxmanifest index 98821d77c8..feaffe2074 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Package.appxmanifest +++ b/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Package.appxmanifest @@ -8,14 +8,14 @@ Tests.System.Reactive.Uwp.DeviceRunner - oren + ian Assets\StoreLogo.png diff --git a/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Tests.System.Reactive.Uwp.DeviceRunner.csproj b/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Tests.System.Reactive.Uwp.DeviceRunner.csproj index cdddd89531..958a2f075b 100644 --- a/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Tests.System.Reactive.Uwp.DeviceRunner.csproj +++ b/Rx.NET/Source/tests/Tests.System.Reactive.Uwp.DeviceRunner/Tests.System.Reactive.Uwp.DeviceRunner.csproj @@ -1,5 +1,5 @@  - + Debug @@ -11,19 +11,21 @@ Tests.System.Reactive.Uwp.DeviceRunner en-US UAP - 10.0.17134.0 - 10.0.16299.0 - 14 + 10.0.18362.0 + 10.0.18362.0 + 17 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + $(VisualStudioVersion) Tests.System.Reactive.Uwp.DeviceRunner_TemporaryKey.pfx - 2BD466C3AB205824BF42514FF6A6F268A0B60966 + 8570A5641EDE61A2AB21E12809E9E0376A041E8C false + True true bin\x86\Debug\ - TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA;HAS_TPL46;NO_REMOTING;NO_SERIALIZABLE;NO_THREAD;CRIPPLED_REFLECTION;WINDOWS;USE_TIMER_SELF_ROOT + TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA;HAS_TPL46;NO_REMOTING;NO_THREAD;WINDOWS;USE_TIMER_SELF_ROOT ;2008;0618 full x86 @@ -33,7 +35,7 @@ bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA;HAS_TPL46;NO_REMOTING;NO_SERIALIZABLE;NO_THREAD;CRIPPLED_REFLECTION;WINDOWS;USE_TIMER_SELF_ROOT + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA;HAS_TPL46;NO_REMOTING;NO_THREAD;WINDOWS;USE_TIMER_SELF_ROOT true ;2008;0618 pdbonly @@ -89,6 +91,9 @@ true true + + $(NoWarn);IDE0003;IDE0016;IDE0017;IDE0018;IDE0019;IDE0020;IDE0031;IDE0032;IDE0034;IDE0037;IDE0038;IDE0039;IDE0040;IDE0044;IDE0051;IDE0052;IDE0056;IDE0057;IDE0059;IDE0060;IDE0062;IDE0063;IDE0071;IDE0074;IDE0075;IDE0076;IDE0077;IDE0079;IDE0083;IDE0090;IDE0180;IDE1006;IDE1056 + @@ -160,6 +165,16 @@ ..\..\ReactiveX.snk + + + 7.0.103 +