From 1a5abeb2ebb47bda07d2167e4484c2523749ac2f Mon Sep 17 00:00:00 2001 From: "Daniel C. Weber" Date: Tue, 28 Aug 2018 12:17:19 +0200 Subject: [PATCH] Emit a warning if the half-serializer ignores a value in ForwardOnNext. (cherry picked from commit 7d2d4c4ec475a382ef42c3ed46e8f59c159f0d10) --- Rx.NET/Source/Directory.build.targets | 6 +++--- .../Source/src/System.Reactive/Internal/HalfSerializer.cs | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Rx.NET/Source/Directory.build.targets b/Rx.NET/Source/Directory.build.targets index 59c66f3578..5a547415a5 100644 --- a/Rx.NET/Source/Directory.build.targets +++ b/Rx.NET/Source/Directory.build.targets @@ -1,7 +1,7 @@ - $(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;DESKTOPCLR + $(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;DESKTOPCLR 10.0.16299.0 @@ -9,9 +9,9 @@ $(DefineConstants);NO_CODE_COVERAGE_ATTRIBUTE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;WINDOWS - $(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;WINDOWS + $(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;WINDOWS - $(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING + $(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs b/Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs index 74c7da55a7..37478653d5 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Diagnostics; using System.Threading; namespace System.Reactive @@ -47,6 +48,10 @@ public static void ForwardOnNext(ISink sink, T item, ref int wip, ref Exce } } } +#if (HAS_TRACE) + else if (error == null) + Trace.TraceWarning("OnNext called while another OnNext call was in progress on the same Observer."); +#endif } ///