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

.NET 5 support for Rx.NET #1291

Merged
merged 19 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Rx.NET/Integration/LinuxTests/LinuxTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net5.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618</NoWarn>
<LangVersion>latest</LangVersion>
<AssemblyName>Tests.System.Reactive</AssemblyName>
Expand All @@ -10,10 +10,10 @@
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING</DefineConstants>
<DefineConstants>$(DefineConstants);</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;LINUX</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' ">
<DefineConstants>$(DefineConstants);LINUX</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,7 +24,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0-preview-20181205-02" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="System.Reactive" Version="4.2.0-preview.63" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0;net5.0-windows10.0.19041</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618</NoWarn>
<LangVersion>latest</LangVersion>
<AssemblyName>Tests.System.Reactive</AssemblyName>
Expand All @@ -12,8 +12,11 @@
</PropertyGroup>


<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;HAS_WINFORMS;HAS_DISPATCHER;DESKTOPCLR</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0-windows'))">
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0-preview-20190203-03" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="System.Reactive" Version="4.2.0-preview.63" />
Expand Down
5 changes: 1 addition & 4 deletions Rx.NET/Integration/global.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"sdk": {
"version": "3.0.100-preview"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.0.31"
"MSBuild.Sdk.Extras": "2.1.2"
}
}
1 change: 0 additions & 1 deletion Rx.NET/Source/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<ItemGroup>
Expand Down
51 changes: 25 additions & 26 deletions Rx.NET/Source/Directory.build.targets
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
<Project>

<!-- Workaround. Remove once we're on 3.1.300+
https://github.com/dotnet/sourcelink/issues/572 -->
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>


<!-- This props all need to be set in targets as they depend on the values set earlier -->

<PropertyGroup>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);HAS_WINRT</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
<DefineConstants>$(DefineConstants);HAS_WINFORMS;HAS_DISPATCHER;HAS_REMOTING;DESKTOPCLR</DefineConstants>
<DefineConstants>$(DefineConstants);HAS_WINFORMS;HAS_WPF;HAS_WINRT;HAS_DISPATCHER;HAS_REMOTING;DESKTOPCLR</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<DefineConstants>$(DefineConstants);NO_CODE_COVERAGE_ATTRIBUTE;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;NO_TRACE;WINDOWS</DefineConstants>
<DefineConstants>$(DefineConstants);HAS_WINRT;NO_CODE_COVERAGE_ATTRIBUTE;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;NO_TRACE;WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<DefineConstants>$(DefineConstants);HAS_WINRT;WINDOWS;HAS_OS_XAML;LEGACY_WINRT</DefineConstants>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>$(DefineConstants)</DefineConstants>
<DefineConstants>$(DefineConstants);HAS_WINRT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<DefineConstants>$(DefineConstants);HAS_WINFORMS;HAS_DISPATCHER;DESKTOPCLR</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0-windows'))">
<DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT</DefineConstants>
</PropertyGroup>


<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net46' or '$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.16299' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

Expand All @@ -52,5 +40,16 @@
</AssemblyAttribute>
</ItemGroup>
</Target>

</Project>


<!-- Remove once coverlet supports this built-in -->
<Target Name="CoverletGetPathMap"
DependsOnTargets="InitializeSourceRootMappedPaths"
Returns="@(_LocalTopLevelSourceRoot)"
Condition="'$(DeterministicSourcePaths)' == 'true'">
<ItemGroup>
<_LocalTopLevelSourceRoot Include="@(SourceRoot)" Condition="'%(SourceRoot.NestedRoot)' == ''"/>
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net46;uap10.0</TargetFrameworks>
<TargetFrameworks>net46;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT License.
// See the LICENSE file in the project root for more information.

#if WINDOWS
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reactive.Concurrency.CoreDispatcherScheduler))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reactive.Linq.CoreDispatcherObservable))]
#else
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reactive.Concurrency.DispatcherScheduler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reactive.Linq.DispatcherObservable))]
#endif
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reactive.Linq.DispatcherObservable))]

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFramework>uap10.0</TargetFramework>
<TargetFramework>uap10.0.16299</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions Rx.NET/Source/global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"sdk": {
"version": "5.0.100-preview"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.1.2"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net46;uap10.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net46;uap10.0.16299;netstandard2.0;net5.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<Description>Reactive Extensions Testing Library containing interfaces and classes providing functionality to test applications and libraries built using Reactive Extensions.</Description>
<AssemblyTitle>Microsoft.Reactive.Testing - Testing Helper Library</AssemblyTitle>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net46;uap10.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net46;uap10.0.16299;net5.0</TargetFrameworks>
<Title>Reactive Extensions - Aliases</Title>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT License.
// See the LICENSE file in the project root for more information.

#if WINDOWS
#if LEGACY_WINRT
using System.ComponentModel;
using Windows.System.Threading;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT License.
// See the LICENSE file in the project root for more information.

#if !WINDOWS && !NO_THREAD
#if !LEGACY_WINRT && !NO_THREAD
using System.Reactive.Disposables;
using System.Threading;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public virtual T GetService<T>(object[] args) where T : class
return (T)(object)new ExceptionServicesImpl();
}

#if !NO_THREAD || WINDOWS
#if !NO_THREAD || LEGACY_WINRT
if (t == typeof(IConcurrencyAbstractionLayer))
{
return (T)(object)new ConcurrencyAbstractionLayerImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void GetEventMethods<TSender, TEventArgs>(Type targetType, object

isWinRT = false;

#if HAS_WINRT
#if HAS_WINRT && !CSWINRT
if (addMethod.ReturnType == typeof(EventRegistrationToken))
{
isWinRT = true;
Expand Down
8 changes: 4 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable.Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable

if (disconnectDelay < TimeSpan.Zero)
{
throw new ArgumentException("disconnectDelay");
throw new ArgumentException("Delay cannot be less than zero", "disconnectDelay");
}

return s_impl.RefCount(source, disconnectDelay);
Expand Down Expand Up @@ -285,7 +285,7 @@ public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable

if (disconnectDelay < TimeSpan.Zero)
{
throw new ArgumentException("disconnectDelay");
throw new ArgumentException("Delay cannot be less than zero", "disconnectDelay");
}

return s_impl.RefCount(source, disconnectDelay, scheduler);
Expand Down Expand Up @@ -333,7 +333,7 @@ public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable

if (disconnectDelay < TimeSpan.Zero)
{
throw new ArgumentException("disconnectDelay");
throw new ArgumentException("Delay cannot be less than zero", "disconnectDelay");
}
if (minObservers <= 0)
{
Expand Down Expand Up @@ -368,7 +368,7 @@ public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable

if (disconnectDelay < TimeSpan.Zero)
{
throw new ArgumentException("disconnectDelay");
throw new ArgumentException("Delay cannot be less than zero", "disconnectDelay");
}
if (minObservers <= 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Fun
{
var d = new MultipleAssignmentDisposable();

var timer = new Windows.Forms.Timer();
var timer = new System.Windows.Forms.Timer();

timer.Tick += (s, e) =>
{
Expand Down Expand Up @@ -174,7 +174,7 @@ public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<

var createTimer = new Func<IScheduler, TState, IDisposable>((scheduler1, state1) =>
{
var timer = new Windows.Forms.Timer();
var timer = new System.Windows.Forms.Timer();

timer.Tick += (s, e) =>
{
Expand Down
Loading