Skip to content

Commit

Permalink
Remove obsolete #if directives (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
idg10 committed Apr 19, 2023
1 parent 677aeb2 commit 5ed1a30
Show file tree
Hide file tree
Showing 59 changed files with 30 additions and 3,023 deletions.
16 changes: 3 additions & 13 deletions Rx.NET/Source/facades/GlobalAssemblyVersion.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
// 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.


using System.Reflection;


#if NETSTANDARD1_0 || WP8
[assembly: AssemblyVersion("3.0.0.0")]
#elif NETSTANDARD1_1 || WINDOWS8 || NET45 || NETCORE45
[assembly: AssemblyVersion("3.0.1000.0")]
#elif NETSTANDARD1_2 || WINDOWS81 || NET451 || NETCORE451 || WPA81
[assembly: AssemblyVersion("3.0.2000.0")]
#elif NETSTANDARD1_3 || NET46
[assembly: AssemblyVersion("3.0.3000.0")]
#elif NETSTANDARD1_4 || UAP10_0 || WINDOWS_UWP || NETCORE50 || NET461
#if WINDOWS_UWP
[assembly: AssemblyVersion("3.0.4000.0")]
#elif NETSTANDARD1_5 || NET462
[assembly: AssemblyVersion("3.0.5000.0")]
#elif NETSTANDARD1_6 || NETCOREAPP1_0 || NET463 || NET472 || NETSTANDARD2_0
#elif NET472 || NETSTANDARD2_0
[assembly: AssemblyVersion("3.0.6000.0")]
#else // this is here to prevent the build system from complaining. It should never be hit
[assembly: AssemblyVersion("invalid")]
Expand Down
2 changes: 0 additions & 2 deletions Rx.NET/Source/src/Microsoft.Reactive.Testing/Recorded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ namespace Microsoft.Reactive.Testing
/// </summary>
/// <typeparam name="T">Type of the value.</typeparam>
[DebuggerDisplay("{Value}@{Time}")]
#if !NO_SERIALIZABLE
[Serializable]
#endif
public readonly struct Recorded<T> : IEquatable<Recorded<T>>
{
// NB: Keep these fields for compat with serialized state.
Expand Down
2 changes: 0 additions & 2 deletions Rx.NET/Source/src/Microsoft.Reactive.Testing/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ namespace Microsoft.Reactive.Testing
/// Records information about subscriptions to and unsubscriptions from observable sequences.
/// </summary>
[DebuggerDisplay("({Subscribe}, {Unsubscribe})")]
#if !NO_SERIALIZABLE
[Serializable]
#endif
public readonly struct Subscription : IEquatable<Subscription>
{
/// <summary>
Expand Down

This file was deleted.

This file was deleted.

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

#if !NO_THREAD
using System.Reactive.Disposables;
using System.Threading;

Expand Down Expand Up @@ -251,4 +250,3 @@ private void Loop()
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,13 @@ public EventLoopScheduler()
{
}

#if !NO_THREAD
/// <summary>
/// Creates an object that schedules units of work on a designated thread, using the specified factory to control thread creation options.
/// </summary>
/// <param name="threadFactory">Factory function for thread creation.</param>
/// <exception cref="ArgumentNullException"><paramref name="threadFactory"/> is <c>null</c>.</exception>
public EventLoopScheduler(Func<ThreadStart, Thread> threadFactory)
{
#else
internal EventLoopScheduler(Func<ThreadStart, Thread> threadFactory)
{
#endif
_threadFactory = threadFactory ?? throw new ArgumentNullException(nameof(threadFactory));
_stopwatch = ConcurrencyAbstractionLayer.Current.StartStopwatch();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@ public NewThreadScheduler()
/// </summary>
public static NewThreadScheduler Default => Instance.Value;

#if !NO_THREAD
/// <summary>
/// Creates an object that schedules each unit of work on a separate thread.
/// </summary>
/// <param name="threadFactory">Factory function for thread creation.</param>
/// <exception cref="ArgumentNullException"><paramref name="threadFactory"/> is <c>null</c>.</exception>
public NewThreadScheduler(Func<ThreadStart, Thread> threadFactory)
{
#else
private NewThreadScheduler(Func<ThreadStart, Thread> threadFactory)
{
#endif
_threadFactory = threadFactory ?? throw new ArgumentNullException(nameof(threadFactory));
}

Expand Down
32 changes: 0 additions & 32 deletions Rx.NET/Source/src/System.Reactive/Concurrency/Thread.Stub.cs

This file was deleted.

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 !LEGACY_WINRT && !NO_THREAD
#if !LEGACY_WINRT
using System.Reactive.Disposables;
using System.Threading;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ public class CurrentPlatformEnlightenmentProvider : IPlatformEnlightenmentProvid
return (T)(object)new ExceptionServicesImpl();
}

#if !NO_THREAD || LEGACY_WINRT
if (t == typeof(IConcurrencyAbstractionLayer))
{
return (T)(object)new ConcurrencyAbstractionLayerImpl();
}
#endif

if (t == typeof(IScheduler) && args != null)
{
Expand Down
2 changes: 0 additions & 2 deletions Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public static void ForwardOnNext<T>(ISink<T> sink, T item, ref int wip, ref Exce
}
}
}
#if !NO_TRACE
else if (error == null)
Trace.TraceWarning("OnNext called while another OnNext call was in progress on the same Observer.");
#endif
}

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ public static Delegate CreateDelegate(Type delegateType, object o, MethodInfo me
}
}

#if (CRIPPLED_REFLECTION && HAS_WINRT)
public static MethodInfo GetMethod(this Type type, string name) => type.GetTypeInfo().GetDeclaredMethod(name);
#endif

/// <summary>
/// Determine whether a type represents a WinRT event registration token
/// (https://learn.microsoft.com/en-us/uwp/api/windows.foundation.eventregistrationtoken).
Expand Down
6 changes: 0 additions & 6 deletions Rx.NET/Source/src/System.Reactive/Internal/Stubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ internal static class Stubs
public static readonly Action<Exception> Throw = static ex => { ex.Throw(); };
}

#if !NO_THREAD
internal static class TimerStubs
{
#if NETSTANDARD1_3
public static readonly System.Threading.Timer Never = new System.Threading.Timer(static _ => { }, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
#else
public static readonly System.Threading.Timer Never = new System.Threading.Timer(static _ => { });
#endif
}
#endif
}

0 comments on commit 5ed1a30

Please sign in to comment.