From 69f752f47c59801f8cb4ed98291594879db92fe1 Mon Sep 17 00:00:00 2001 From: Mauro Servienti Date: Sun, 12 Dec 2021 17:37:28 +0100 Subject: [PATCH 1/4] test against 3.1 --- src/Radical.Tests/Radical.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Radical.Tests/Radical.Tests.csproj b/src/Radical.Tests/Radical.Tests.csproj index c7cbbe0e..e7b924c7 100644 --- a/src/Radical.Tests/Radical.Tests.csproj +++ b/src/Radical.Tests/Radical.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0 + netcoreapp3.1 From b978aee11730e699a8d9e2fec008c5492b00ae1d Mon Sep 17 00:00:00 2001 From: Mauro Servienti Date: Sun, 12 Dec 2021 17:38:08 +0100 Subject: [PATCH 2/4] Deprecate message broker sync API --- .../ComponentModel/Messaging/IMessageBroker.cs | 18 ++++++++++++++++++ src/Radical/Messaging/MessageBroker.cs | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/Radical/ComponentModel/Messaging/IMessageBroker.cs b/src/Radical/ComponentModel/Messaging/IMessageBroker.cs index e3016310..b6d7c3e6 100644 --- a/src/Radical/ComponentModel/Messaging/IMessageBroker.cs +++ b/src/Radical/ComponentModel/Messaging/IMessageBroker.cs @@ -35,6 +35,7 @@ public interface IMessageBroker /// The sender filter. /// Type of the message. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Type messageType, Action callback); /// @@ -47,6 +48,7 @@ public interface IMessageBroker /// Type of the message. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Type messageType, InvocationModel invocationModel, Action callback); /// @@ -56,6 +58,7 @@ public interface IMessageBroker /// The subscriber. /// Type of the message. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Type messageType, Action callback); /// @@ -66,6 +69,7 @@ public interface IMessageBroker /// Type of the message. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Type messageType, InvocationModel invocationModel, Action callback); /// @@ -75,6 +79,7 @@ public interface IMessageBroker /// The type of message the subscriber is interested in. /// The subscriber. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Action callback); /// @@ -87,6 +92,7 @@ public interface IMessageBroker /// Type of the message. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Type messageType, Func callbackFilter, Action callback); /// @@ -100,6 +106,7 @@ public interface IMessageBroker /// The invocation model. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Type messageType, InvocationModel invocationModel, Func callbackFilter, Action callback); /// @@ -110,6 +117,7 @@ public interface IMessageBroker /// Type of the message. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Type messageType, Func callbackFilter, Action callback); /// @@ -121,6 +129,7 @@ public interface IMessageBroker /// The invocation model. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Type messageType, InvocationModel invocationModel, Func callbackFilter, Action callback); /// @@ -131,6 +140,7 @@ public interface IMessageBroker /// The subscriber. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, Func callbackFilter, Action callback); /// @@ -161,6 +171,7 @@ public interface IMessageBroker /// The subscriber. /// The sender filter. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Action callback); /// @@ -173,6 +184,7 @@ public interface IMessageBroker /// The sender filter. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, InvocationModel invocationModel, Action callback); /// @@ -183,6 +195,7 @@ public interface IMessageBroker /// The subscriber. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, InvocationModel invocationModel, Action callback); /// @@ -195,6 +208,7 @@ public interface IMessageBroker /// The sender filter. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, Func callbackFilter, Action callback); /// @@ -208,6 +222,7 @@ public interface IMessageBroker /// The invocation model. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, object sender, InvocationModel invocationModel, Func callbackFilter, Action callback); /// @@ -219,6 +234,7 @@ public interface IMessageBroker /// The invocation model. /// The filter invoked to determine if the callback should be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] void Subscribe(object subscriber, InvocationModel invocationModel, Func callbackFilter, Action callback); /// @@ -265,6 +281,7 @@ public interface IMessageBroker /// /// The sender. /// The message. + [Obsolete("Broadcast is deprecated. Use BroadcastAsync. It will be treated as an error in v3 and removed in v4.", error: false)] void Broadcast(object sender, object message); /// @@ -281,6 +298,7 @@ public interface IMessageBroker /// /// The sender. /// The message to dispatch. + [Obsolete("Dispatch is deprecated. Use BroadcastAsync. It will be treated as an error in v3 and removed in v4.", error: false)] void Dispatch(object sender, object message); } } \ No newline at end of file diff --git a/src/Radical/Messaging/MessageBroker.cs b/src/Radical/Messaging/MessageBroker.cs index 4c42423a..07bd766e 100644 --- a/src/Radical/Messaging/MessageBroker.cs +++ b/src/Radical/Messaging/MessageBroker.cs @@ -115,6 +115,7 @@ void SubscribeCore(Type messageType, ISubscription subscription) /// The type of message the subecriber is interested in. /// The subscriber. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Action callback) { Subscribe(subscriber, InvocationModel.Default, callback); @@ -129,6 +130,7 @@ public void Subscribe(object subscriber, Action callback) /// The subscriber. /// The sender filter. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Action callback) { Subscribe(subscriber, sender, InvocationModel.Default, callback); @@ -141,6 +143,7 @@ public void Subscribe(object subscriber, object sender, Action cal /// The subscriber. /// Type of the message. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Type messageType, Action callback) { Subscribe(subscriber, messageType, InvocationModel.Default, callback); @@ -155,6 +158,7 @@ public void Subscribe(object subscriber, Type messageType, ActionThe sender filter. /// Type of the message. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Type messageType, Action callback) { Subscribe(subscriber, sender, messageType, InvocationModel.Default, callback); @@ -168,6 +172,7 @@ public void Subscribe(object subscriber, object sender, Type messageType, Action /// The subscriber. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, InvocationModel invocationModel, Action callback) { Subscribe(subscriber, invocationModel, (s, msg) => true, callback); @@ -181,6 +186,7 @@ public void Subscribe(object subscriber, InvocationModel invocationModel, Act /// Type of the message. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Type messageType, InvocationModel invocationModel, Action callback) { Subscribe(subscriber, messageType, invocationModel, (s, msg) => true, callback); @@ -196,6 +202,7 @@ public void Subscribe(object subscriber, Type messageType, InvocationModel invoc /// Type of the message. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Type messageType, InvocationModel invocationModel, Action callback) { Subscribe(subscriber, sender, messageType, invocationModel, (s, msg) => true, callback); @@ -211,6 +218,7 @@ public void Subscribe(object subscriber, object sender, Type messageType, Invoca /// The sender filter. /// The invocation model. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, InvocationModel invocationModel, Action callback) { Subscribe(subscriber, sender, invocationModel, (s, msg) => true, callback); @@ -460,6 +468,7 @@ IEnumerable GetSubscriptionsFor(Type messageType, object sender) } } + [Obsolete("Dispatch is deprecated. Use BroadcastAsync. It will be treated as an error in v3 and removed in v4.", error: false)] public void Dispatch(object sender, object message) { Ensure.That(sender).Named(() => sender).IsNotNull(); @@ -492,6 +501,7 @@ public void Dispatch(object sender, object message) /// /// The sender. /// The message. + [Obsolete("Broadcast is deprecated. Use BroadcastAsync. It will be treated as an error in v3 and removed in v4.", error: false)] public void Broadcast(object sender, object message) { Ensure.That(message).Named(() => message).IsNotNull(); @@ -603,6 +613,7 @@ public void Subscribe(object subscriber, Func> callback /// Type of the message. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Type messageType, Func callbackFilter, Action callback) { Subscribe(subscriber, sender, messageType, InvocationModel.Default, callbackFilter, callback); @@ -619,6 +630,7 @@ public void Subscribe(object subscriber, object sender, Type messageType, FuncThe invocation model. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Type messageType, InvocationModel invocationModel, Func callbackFilter, Action callback) { Ensure.That(subscriber).Named(() => subscriber).IsNotNull(); @@ -640,6 +652,7 @@ public void Subscribe(object subscriber, object sender, Type messageType, Invoca /// Type of the message. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Type messageType, Func callbackFilter, Action callback) { Subscribe(subscriber, messageType, InvocationModel.Default, callbackFilter, callback); @@ -654,6 +667,7 @@ public void Subscribe(object subscriber, Type messageType, FuncThe invocation model. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Type messageType, InvocationModel invocationModel, Func callbackFilter, Action callback) { Ensure.That(subscriber).Named(() => subscriber).IsNotNull(); @@ -674,6 +688,7 @@ public void Subscribe(object subscriber, Type messageType, InvocationModel invoc /// The subscriber. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, Func callbackFilter, Action callback) { Subscribe(subscriber, InvocationModel.Default, callbackFilter, callback); @@ -689,6 +704,7 @@ public void Subscribe(object subscriber, Func callbackFilter /// The sender filter. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, Func callbackFilter, Action callback) { Subscribe(subscriber, sender, InvocationModel.Default, callbackFilter, callback); @@ -705,6 +721,7 @@ public void Subscribe(object subscriber, object sender, Func /// The invocation model. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, object sender, InvocationModel invocationModel, Func callbackFilter, Action callback) { Ensure.That(subscriber).Named(() => subscriber).IsNotNull(); @@ -726,6 +743,7 @@ public void Subscribe(object subscriber, object sender, InvocationModel invoc /// The invocation model. /// The filter invoked to determine if the callback shopuld be invoked. /// The callback. + [Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts a Func. It will be treated as an error in v3 and removed in v4.", error: false)] public void Subscribe(object subscriber, InvocationModel invocationModel, Func callbackFilter, Action callback) { Ensure.That(subscriber).Named(() => subscriber).IsNotNull(); From 2586a28ddc351e6c55e2505fbd43985823d6e3b5 Mon Sep 17 00:00:00 2001 From: Mauro Servienti Date: Sun, 12 Dec 2021 17:51:56 +0100 Subject: [PATCH 3/4] Ignore noisy attributes --- .../API/APIApprovals.Approve_API.approved.txt | 105 +++++++++++++++++- src/Radical.Tests/API/APIApprovals.cs | 5 +- 2 files changed, 108 insertions(+), 2 deletions(-) diff --git a/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt b/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt index b0ab7c90..0d75c004 100644 --- a/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt +++ b/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt @@ -2,7 +2,6 @@ [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Radical.Tests")] [assembly: System.Runtime.InteropServices.ComVisible(false)] [assembly: System.Runtime.InteropServices.Guid("ac1104e2-8764-42ea-80aa-bfd22bc6a89f")] -[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName="")] namespace Radical { public sealed class ActionTextWriter : System.IO.TextWriter @@ -926,26 +925,78 @@ namespace Radical.ComponentModel.Messaging } public interface IMessageBroker { + [System.Obsolete("Broadcast is deprecated. Use BroadcastAsync. It will be treated as an error in v3" + + " and removed in v4.", false)] void Broadcast(object sender, object message); System.Threading.Tasks.Task BroadcastAsync(object sender, object message); + [System.Obsolete("Dispatch is deprecated. Use BroadcastAsync. It will be treated as an error in v3 " + + "and removed in v4.", false)] void Dispatch(object sender, object message); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Type messageType, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Type messageType, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Type messageType, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Type messageType, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Action callback); void Subscribe(object subscriber, System.Func callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, System.Func callbackFilter, System.Action callback); void Subscribe(object subscriber, System.Func> callbackFilter, System.Func callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, System.Func callbackFilter, System.Action callback); + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] void Subscribe(object subscriber, object sender, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback); void Unsubscribe(object subscriber); void Unsubscribe(object subscriber, object sender); @@ -1179,26 +1230,78 @@ namespace Radical.Messaging { public MessageBroker(Radical.ComponentModel.IDispatcher dispatcher) { } public MessageBroker(Radical.ComponentModel.IDispatcher dispatcher, System.Threading.Tasks.TaskFactory factory) { } + [System.Obsolete("Broadcast is deprecated. Use BroadcastAsync. It will be treated as an error in v3" + + " and removed in v4.", false)] public void Broadcast(object sender, object message) { } public System.Threading.Tasks.Task BroadcastAsync(object sender, object message) { } + [System.Obsolete("Dispatch is deprecated. Use BroadcastAsync. It will be treated as an error in v3 " + + "and removed in v4.", false)] public void Dispatch(object sender, object message) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Type messageType, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Type messageType, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Type messageType, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Type messageType, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Type messageType, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Action callback) { } public void Subscribe(object subscriber, System.Func callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, System.Func callbackFilter, System.Action callback) { } public void Subscribe(object subscriber, System.Func> callbackFilter, System.Func callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, System.Func callbackFilter, System.Action callback) { } + [System.Obsolete("The synchronous version of Subscribe is deprecated. Use the overload that accepts" + + " a Func. It will be treated as an error in v3 and removed" + + " in v4.", false)] public void Subscribe(object subscriber, object sender, Radical.ComponentModel.Messaging.InvocationModel invocationModel, System.Func callbackFilter, System.Action callback) { } public void Unsubscribe(object subscriber) { } public void Unsubscribe(object subscriber, object sender) { } diff --git a/src/Radical.Tests/API/APIApprovals.cs b/src/Radical.Tests/API/APIApprovals.cs index 43aa6c0b..9ef16216 100644 --- a/src/Radical.Tests/API/APIApprovals.cs +++ b/src/Radical.Tests/API/APIApprovals.cs @@ -16,7 +16,10 @@ public class APIApprovals [UseReporter(typeof(DiffReporter))] public void Approve_API() { - var publicApi = ApiGenerator.GeneratePublicApi(typeof(IMessageBroker).Assembly, options: null); + var publicApi = ApiGenerator.GeneratePublicApi(typeof(IMessageBroker).Assembly, options: new ApiGeneratorOptions + { + ExcludeAttributes = new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" } + }); Approvals.Verify(publicApi); } From ccb197fcdc881c30887204594f759eba843f80bf Mon Sep 17 00:00:00 2001 From: Mauro Servienti Date: Sun, 12 Dec 2021 18:32:44 +0100 Subject: [PATCH 4/4] Deprecate constructor --- src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt | 1 + src/Radical/Messaging/MessageBroker.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt b/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt index 0d75c004..3a5ab249 100644 --- a/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt +++ b/src/Radical.Tests/API/APIApprovals.Approve_API.approved.txt @@ -1229,6 +1229,7 @@ namespace Radical.Messaging public class MessageBroker : Radical.ComponentModel.Messaging.IMessageBroker { public MessageBroker(Radical.ComponentModel.IDispatcher dispatcher) { } + [System.Obsolete("Constructing a message broker with a task factory is deprecated.", false)] public MessageBroker(Radical.ComponentModel.IDispatcher dispatcher, System.Threading.Tasks.TaskFactory factory) { } [System.Obsolete("Broadcast is deprecated. Use BroadcastAsync. It will be treated as an error in v3" + " and removed in v4.", false)] diff --git a/src/Radical/Messaging/MessageBroker.cs b/src/Radical/Messaging/MessageBroker.cs index 07bd766e..b5091d16 100644 --- a/src/Radical/Messaging/MessageBroker.cs +++ b/src/Radical/Messaging/MessageBroker.cs @@ -59,6 +59,7 @@ public MessageBroker(IDispatcher dispatcher) /// /// The dispatcher. /// The factory. + [Obsolete("Constructing a message broker with a task factory is deprecated.", error: false)] public MessageBroker(IDispatcher dispatcher, TaskFactory factory) { Ensure.That(dispatcher).Named("dispatcher").IsNotNull();