summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/slice2cs/Gen.cpp10
-rw-r--r--csharp/src/Ice/Discovery/Locator.cs32
-rw-r--r--csharp/src/Ice/Discovery/LocatorRegistry.cs26
-rw-r--r--csharp/src/Ice/IObject.cs42
-rw-r--r--csharp/src/Ice/LoggerAdmin.cs20
-rw-r--r--csharp/src/Ice/LoggerAdminLogger.cs2
-rw-r--r--csharp/src/Ice/MetricsAdmin.cs32
-rw-r--r--csharp/src/Ice/Process.cs16
-rw-r--r--csharp/src/Ice/PropertiesAdmin.cs22
-rw-r--r--csharp/test/Ice/admin/TestI.cs2
-rw-r--r--csharp/test/Ice/alias/Test.ice2
-rw-r--r--csharp/test/Ice/defaultServant/MyObjectI.cs4
-rw-r--r--csharp/test/Ice/metrics/AllTests.cs2
-rw-r--r--csharp/test/Ice/operations/MyDerivedClassAMDI.cs18
-rw-r--r--csharp/test/Ice/operations/MyDerivedClassI.cs22
-rw-r--r--csharp/test/Ice/proxy/MyDerivedClassAMDI.cs4
-rw-r--r--csharp/test/Ice/proxy/MyDerivedClassI.cs6
-rw-r--r--csharp/test/IceBox/admin/TestServiceI.cs2
18 files changed, 154 insertions, 110 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index be116e3791f..66ce32bef3c 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -2773,13 +2773,13 @@ Slice::Gen::DispatcherVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p)
}
_out << sp;
- _out << nl << "string ZeroC.Ice.IObject.IceId("
+ _out << nl << "global::System.Threading.Tasks.ValueTask<string> ZeroC.Ice.IObject.IceIdAsync("
<< "ZeroC.Ice.Current current, "
- << "global::System.Threading.CancellationToken cancel) => _iceTypeId;";
+ << "global::System.Threading.CancellationToken cancel) => new(_iceTypeId);";
_out << sp;
- _out << nl << "global::System.Collections.Generic.IEnumerable<string> "
- << "ZeroC.Ice.IObject.IceIds(ZeroC.Ice.Current current, "
- << "global::System.Threading.CancellationToken cancel) => _iceAllTypeIds;";
+ _out << nl << "global::System.Threading.Tasks.ValueTask<global::System.Collections.Generic.IEnumerable<string>> "
+ << "ZeroC.Ice.IObject.IceIdsAsync(ZeroC.Ice.Current current, "
+ << "global::System.Threading.CancellationToken cancel) => new(_iceAllTypeIds);";
_out << sp;
_out << nl << "global::System.Threading.Tasks.ValueTask<ZeroC.Ice.OutgoingResponseFrame> ZeroC.Ice.IObject"
diff --git a/csharp/src/Ice/Discovery/Locator.cs b/csharp/src/Ice/Discovery/Locator.cs
index 14673bf24da..8e5fea27bdd 100644
--- a/csharp/src/Ice/Discovery/Locator.cs
+++ b/csharp/src/Ice/Discovery/Locator.cs
@@ -307,7 +307,7 @@ namespace ZeroC.Ice.Discovery
// If the timeout was canceled we delay the completion of the request to give a chance to other
// members of this replica group to reply
return await
- replyServant.WaitForReplicaGroupRepliesAsync(start, _latencyMultiplier).ConfigureAwait(false);
+ replyServant.GetReplicaGroupRepliesAsync(start, _latencyMultiplier).ConfigureAwait(false);
}
// else timeout, so we retry until _retryCount
}
@@ -338,9 +338,7 @@ namespace ZeroC.Ice.Discovery
_replyAdapter.Remove(Identity);
}
- internal void SetEmptyResult() => _completionSource.SetResult(_emptyResult);
-
- internal async Task<TResult> WaitForReplicaGroupRepliesAsync(TimeSpan start, int latencyMultiplier)
+ internal async Task<TResult> GetReplicaGroupRepliesAsync(TimeSpan start, int latencyMultiplier)
{
// This method is called by InvokeAsync after the first reply from a replica group to wait for additional
// replies from the replica group.
@@ -355,6 +353,8 @@ namespace ZeroC.Ice.Discovery
return await Task.ConfigureAwait(false);
}
+ internal void SetEmptyResult() => _completionSource.SetResult(_emptyResult);
+
private protected ReplyServant(TResult emptyResult, ObjectAdapter replyAdapter)
{
// Add servant (this) to object adapter with new UUID identity.
@@ -378,12 +378,12 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface FindAdapterByIdReply.</summary>
- internal sealed class FindAdapterByIdReply : ReplyServant<IObjectPrx?>, IFindAdapterByIdReply
+ internal sealed class FindAdapterByIdReply : ReplyServant<IObjectPrx?>, IAsyncFindAdapterByIdReply
{
private readonly object _mutex = new();
private readonly HashSet<IObjectPrx> _proxies = new();
- public void FoundAdapterById(
+ public ValueTask FoundAdapterByIdAsync(
string adapterId,
IObjectPrx proxy,
bool isReplicaGroup,
@@ -407,6 +407,7 @@ namespace ZeroC.Ice.Discovery
{
SetResult(proxy);
}
+ return default;
}
internal FindAdapterByIdReply(ObjectAdapter replyAdapter)
@@ -431,10 +432,13 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface FindObjectByIdReply.</summary>
- internal class FindObjectByIdReply : ReplyServant<IObjectPrx?>, IFindObjectByIdReply
+ internal class FindObjectByIdReply : ReplyServant<IObjectPrx?>, IAsyncFindObjectByIdReply
{
- public void FoundObjectById(Identity id, IObjectPrx proxy, Current current, CancellationToken cancel) =>
+ public ValueTask FoundObjectByIdAsync(Identity id, IObjectPrx proxy, Current current, CancellationToken cancel)
+ {
SetResult(proxy);
+ return default;
+ }
internal FindObjectByIdReply(ObjectAdapter replyAdapter)
: base(emptyResult: null, replyAdapter)
@@ -443,12 +447,12 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface ResolveAdapterIdReply.</summary>
- internal sealed class ResolveAdapterIdReply : ReplyServant<IReadOnlyList<EndpointData>>, IResolveAdapterIdReply
+ internal sealed class ResolveAdapterIdReply : ReplyServant<IReadOnlyList<EndpointData>>, IAsyncResolveAdapterIdReply
{
private readonly object _mutex = new();
private readonly HashSet<EndpointData> _endpointDataSet = new();
- public void FoundAdapterId(
+ public ValueTask FoundAdapterIdAsync(
EndpointData[] endpoints,
bool isReplicaGroup,
Current current,
@@ -471,6 +475,7 @@ namespace ZeroC.Ice.Discovery
{
SetResult(endpoints);
}
+ return default;
}
internal ResolveAdapterIdReply(ObjectAdapter replyAdapter)
@@ -489,10 +494,13 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface ResolveWellKnownProxyReply.</summary>
- internal class ResolveWellKnownProxyReply : ReplyServant<string>, IResolveWellKnownProxyReply
+ internal class ResolveWellKnownProxyReply : ReplyServant<string>, IAsyncResolveWellKnownProxyReply
{
- public void FoundWellKnownProxy(string adapterId, Current current, CancellationToken cancel) =>
+ public ValueTask FoundWellKnownProxyAsync(string adapterId, Current current, CancellationToken cancel)
+ {
SetResult(adapterId);
+ return default;
+ }
internal ResolveWellKnownProxyReply(ObjectAdapter replyAdapter)
: base(emptyResult: "", replyAdapter)
diff --git a/csharp/src/Ice/Discovery/LocatorRegistry.cs b/csharp/src/Ice/Discovery/LocatorRegistry.cs
index d2985909a72..c4055743591 100644
--- a/csharp/src/Ice/Discovery/LocatorRegistry.cs
+++ b/csharp/src/Ice/Discovery/LocatorRegistry.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace ZeroC.Ice.Discovery
{
/// <summary>Servant class that implements the Slice interface Ice::LocatorRegistry.</summary>
- internal class LocatorRegistry : ILocatorRegistry
+ internal class LocatorRegistry : IAsyncLocatorRegistry
{
private readonly IObjectPrx _dummyIce1Proxy;
private readonly IObjectPrx _dummyIce2Proxy;
@@ -22,7 +22,7 @@ namespace ZeroC.Ice.Discovery
private readonly Dictionary<(string AdapterId, Protocol Protocol), HashSet<string>> _replicaGroups = new();
- public void RegisterAdapterEndpoints(
+ public ValueTask RegisterAdapterEndpointsAsync(
string adapterId,
string replicaGroupId,
EndpointData[] endpoints,
@@ -35,16 +35,17 @@ namespace ZeroC.Ice.Discovery
}
RegisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice2, endpoints, _ice2Adapters);
+ return default;
}
- public void SetAdapterDirectProxy(
+ public ValueTask SetAdapterDirectProxyAsync(
string adapterId,
IObjectPrx? proxy,
Current current,
CancellationToken cancel) =>
- SetReplicatedAdapterDirectProxy(adapterId, "", proxy, current, cancel);
+ SetReplicatedAdapterDirectProxyAsync(adapterId, "", proxy, current, cancel);
- public void SetReplicatedAdapterDirectProxy(
+ public ValueTask SetReplicatedAdapterDirectProxyAsync(
string adapterId,
string replicaGroupId,
IObjectPrx? proxy,
@@ -59,23 +60,24 @@ namespace ZeroC.Ice.Discovery
{
UnregisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice1, _ice1Adapters);
}
+ return default;
}
- public void SetServerProcessProxy(
+ public ValueTask SetServerProcessProxyAsync(
string serverId,
IProcessPrx process,
Current current,
- CancellationToken cancel)
- {
- // Ignored
- }
+ CancellationToken cancel) => default; // Ignored
- public void UnregisterAdapterEndpoints(
+ public ValueTask UnregisterAdapterEndpointsAsync(
string adapterId,
string replicaGroupId,
Current current,
- CancellationToken cancel) =>
+ CancellationToken cancel)
+ {
UnregisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice2, _ice2Adapters);
+ return default;
+ }
internal LocatorRegistry(Communicator communicator)
{
diff --git a/csharp/src/Ice/IObject.cs b/csharp/src/Ice/IObject.cs
index 8162fd05b91..54924fcbbaa 100644
--- a/csharp/src/Ice/IObject.cs
+++ b/csharp/src/Ice/IObject.cs
@@ -97,15 +97,15 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is cancelled.
/// </param>
/// <returns>The Slice type ID of the most-derived interface.</returns>
- public string IceId(Current current, CancellationToken cancel) => "::Ice::Object";
+ public ValueTask<string> IceIdAsync(Current current, CancellationToken cancel) => new("::Ice::Object");
/// <summary>Returns the Slice type IDs of the interfaces supported by this object.</summary>
/// <param name="current">The Current object for the dispatch.</param>
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>The Slice type IDs of the interfaces supported by this object, in alphabetical order.</returns>
- public IEnumerable<string> IceIds(Current current, CancellationToken cancel) =>
- new string[] { "::Ice::Object" };
+ public ValueTask<IEnumerable<string>> IceIdsAsync(Current current, CancellationToken cancel) =>
+ new(new string[] { "::Ice::Object" });
/// <summary>Tests whether this object supports the specified Slice interface.</summary>
/// <param name="typeId">The type ID of the Slice interface to test against.</param>
@@ -113,17 +113,17 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>True if this object implements the interface specified by typeId.</returns>
- public bool IceIsA(string typeId, Current current, CancellationToken cancel) =>
- Array.BinarySearch((string[])IceIds(current, cancel), typeId, StringComparer.Ordinal) >= 0;
+ public async ValueTask<bool> IceIsAAsync(string typeId, Current current, CancellationToken cancel)
+ {
+ var array = (string[])await IceIdsAsync(current, cancel).ConfigureAwait(false);
+ return Array.BinarySearch(array, typeId, StringComparer.Ordinal) >= 0;
+ }
/// <summary>Tests whether this object can be reached.</summary>
/// <param name="current">The Current object for the dispatch.</param>
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
- public void IcePing(Current current, CancellationToken cancel)
- {
- // Does nothing
- }
+ public ValueTask IcePingAsync(Current current, CancellationToken cancel) => default;
/// <summary>The generated code calls this method to ensure that when an operation is _not_ declared
/// idempotent, the request is not marked idempotent. If the request is marked idempotent, it means the caller
@@ -145,14 +145,14 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>The response frame.</returns>
- protected ValueTask<OutgoingResponseFrame> IceDIceIdAsync(
+ protected async ValueTask<OutgoingResponseFrame> IceDIceIdAsync(
IncomingRequestFrame request,
Current current,
CancellationToken cancel)
{
request.ReadEmptyArgs();
- string returnValue = IceId(current, cancel);
- return new ValueTask<OutgoingResponseFrame>(Response.IceId(current, returnValue));
+ string returnValue = await IceIdAsync(current, cancel).ConfigureAwait(false);
+ return Response.IceId(current, returnValue);
}
/// <summary>Dispatches an ice_ids request.</summary>
@@ -161,14 +161,14 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>The response frame.</returns>
- protected ValueTask<OutgoingResponseFrame> IceDIceIdsAsync(
+ protected async ValueTask<OutgoingResponseFrame> IceDIceIdsAsync(
IncomingRequestFrame request,
Current current,
CancellationToken cancel)
{
request.ReadEmptyArgs();
- IEnumerable<string> returnValue = IceIds(current, cancel);
- return new ValueTask<OutgoingResponseFrame>(Response.IceIds(current, returnValue));
+ IEnumerable<string> returnValue = await IceIdsAsync(current, cancel).ConfigureAwait(false);
+ return Response.IceIds(current, returnValue);
}
/// <summary>Dispatches an ice_isA request.</summary>
@@ -177,14 +177,14 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>The response frame.</returns>
- protected ValueTask<OutgoingResponseFrame> IceDIceIsAAsync(
+ protected async ValueTask<OutgoingResponseFrame> IceDIceIsAAsync(
IncomingRequestFrame request,
Current current,
CancellationToken cancel)
{
string id = Request.IceIsA(current.Connection, request);
- bool returnValue = IceIsA(id, current, cancel);
- return new ValueTask<OutgoingResponseFrame>(Response.IceIsA(current, returnValue));
+ bool returnValue = await IceIsAAsync(id, current, cancel).ConfigureAwait(false);
+ return Response.IceIsA(current, returnValue);
}
/// <summary>Dispatches an ice_ping request.</summary>
@@ -193,14 +193,14 @@ namespace ZeroC.Ice
/// <param name="cancel">A cancellation token that is notified of cancellation when the dispatch is canceled.
/// </param>
/// <returns>The response frame.</returns>
- protected ValueTask<OutgoingResponseFrame> IceDIcePingAsync(
+ protected async ValueTask<OutgoingResponseFrame> IceDIcePingAsync(
IncomingRequestFrame request,
Current current,
CancellationToken cancel)
{
request.ReadEmptyArgs();
- IcePing(current, cancel);
- return new ValueTask<OutgoingResponseFrame>(OutgoingResponseFrame.WithVoidReturnValue(current));
+ await IcePingAsync(current, cancel).ConfigureAwait(false);
+ return OutgoingResponseFrame.WithVoidReturnValue(current);
}
}
}
diff --git a/csharp/src/Ice/LoggerAdmin.cs b/csharp/src/Ice/LoggerAdmin.cs
index afb4baf42fb..0cfb8169e18 100644
--- a/csharp/src/Ice/LoggerAdmin.cs
+++ b/csharp/src/Ice/LoggerAdmin.cs
@@ -94,7 +94,7 @@ namespace ZeroC.Ice
}
}
- internal sealed class LoggerAdmin : ILoggerAdmin, IAsyncDisposable
+ internal sealed class LoggerAdmin : IAsyncLoggerAdmin, IAsyncDisposable
{
internal int TraceLevel { get; }
internal const string TraceCategory = "Admin.Logger";
@@ -111,7 +111,7 @@ namespace ZeroC.Ice
private Communicator? _sendLogCommunicator;
private int _traceCount;
- public void AttachRemoteLogger(
+ public ValueTask AttachRemoteLoggerAsync(
IRemoteLoggerPrx? prx,
LogMessageType[] types,
string[] categories,
@@ -121,7 +121,7 @@ namespace ZeroC.Ice
{
if (prx == null)
{
- return; // can't send this null RemoteLogger anything!
+ return default; // can't send this null RemoteLogger anything!
}
var messageTypes = new HashSet<LogMessageType>(types);
@@ -178,13 +178,17 @@ namespace ZeroC.Ice
}
logForwarder.Queue("init", _logger, prx => prx.InitAsync(_logger.Prefix, initLogMessages.ToArray()));
+ return default;
}
- public bool DetachRemoteLogger(IRemoteLoggerPrx? remoteLogger, Current current, CancellationToken cancel)
+ public ValueTask<bool> DetachRemoteLoggerAsync(
+ IRemoteLoggerPrx? remoteLogger,
+ Current current,
+ CancellationToken cancel)
{
if (remoteLogger == null)
{
- return false;
+ return new(false);
}
bool found = RemoveLogForwarder(remoteLogger.Identity);
@@ -201,10 +205,10 @@ namespace ZeroC.Ice
}
}
- return found;
+ return new(found);
}
- public (IEnumerable<LogMessage>, string) GetLog(
+ public ValueTask<(IEnumerable<LogMessage>, string)> GetLogAsync(
LogMessageType[] types,
string[] categories,
int messageMax,
@@ -230,7 +234,7 @@ namespace ZeroC.Ice
var traceCategories = new HashSet<string>(categories);
FilterLogMessages(logMessages, messageTypes, traceCategories, messageMax);
}
- return (logMessages.ToArray(), _logger.Prefix);
+ return new((logMessages.ToArray(), _logger.Prefix));
}
internal LoggerAdmin(Communicator communicator, LoggerAdminLogger logger)
diff --git a/csharp/src/Ice/LoggerAdminLogger.cs b/csharp/src/Ice/LoggerAdminLogger.cs
index b882caed191..72215248dcb 100644
--- a/csharp/src/Ice/LoggerAdminLogger.cs
+++ b/csharp/src/Ice/LoggerAdminLogger.cs
@@ -35,7 +35,7 @@ namespace ZeroC.Ice
Log(logMessage);
}
- public ILoggerAdmin GetFacet() => _loggerAdmin;
+ public IAsyncLoggerAdmin GetFacet() => _loggerAdmin;
public void Print(string message)
{
diff --git a/csharp/src/Ice/MetricsAdmin.cs b/csharp/src/Ice/MetricsAdmin.cs
index 27e8616401b..75fe08bdca4 100644
--- a/csharp/src/Ice/MetricsAdmin.cs
+++ b/csharp/src/Ice/MetricsAdmin.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
+using System.Threading.Tasks;
using ZeroC.IceMX;
namespace ZeroC.Ice
@@ -417,7 +418,7 @@ namespace ZeroC.Ice
}
}
- internal class MetricsAdmin : IMetricsAdmin
+ internal class MetricsAdmin : IAsyncMetricsAdmin
{
internal ILogger Logger { get; }
@@ -438,7 +439,7 @@ namespace ZeroC.Ice
private readonly object _mutex = new object();
private Dictionary<string, MetricsView> _views = new Dictionary<string, MetricsView>();
- public void DisableMetricsView(string name, Current current, CancellationToken cancel)
+ public ValueTask DisableMetricsViewAsync(string name, Current current, CancellationToken cancel)
{
lock (_mutex)
{
@@ -446,9 +447,10 @@ namespace ZeroC.Ice
_communicator.SetProperty($"IceMX.Metrics.{name}.Disabled", "1");
}
UpdateViews();
+ return default;
}
- public void EnableMetricsView(string name, Current current, CancellationToken cancel)
+ public ValueTask EnableMetricsViewAsync(string name, Current current, CancellationToken cancel)
{
lock (_mutex)
{
@@ -456,9 +458,10 @@ namespace ZeroC.Ice
_communicator.SetProperty($"IceMX.Metrics.{name}.Disabled", "0");
}
UpdateViews();
+ return default;
}
- public IEnumerable<MetricsFailures> GetMapMetricsFailures(
+ public ValueTask<IEnumerable<MetricsFailures>> GetMapMetricsFailuresAsync(
string viewName,
string mapName,
Current current,
@@ -466,12 +469,12 @@ namespace ZeroC.Ice
{
lock (_mutex)
{
- return GetMetricsView(viewName) is MetricsView view ?
- view.GetFailures(mapName) : Array.Empty<MetricsFailures>();
+ return new(GetMetricsView(viewName) is MetricsView view ?
+ view.GetFailures(mapName) : Array.Empty<MetricsFailures>());
}
}
- public MetricsFailures GetMetricsFailures(
+ public ValueTask<MetricsFailures> GetMetricsFailuresAsync(
string viewName,
string mapName,
string id,
@@ -480,13 +483,13 @@ namespace ZeroC.Ice
{
lock (_mutex)
{
- return GetMetricsView(viewName) is MetricsView view &&
+ return new(GetMetricsView(viewName) is MetricsView view &&
view.GetFailures(mapName, id) is MetricsFailures failures ?
- failures : new MetricsFailures(id, new Dictionary<string, int>());
+ failures : new MetricsFailures(id, new Dictionary<string, int>()));
}
}
- public (IReadOnlyDictionary<string, Metrics?[]>, long) GetMetricsView(
+ public ValueTask<(IReadOnlyDictionary<string, Metrics?[]>, long)> GetMetricsViewAsync(
string viewName,
Current current,
CancellationToken cancel)
@@ -495,22 +498,23 @@ namespace ZeroC.Ice
{
if (GetMetricsView(viewName) is MetricsView view)
{
- return (view.GetMetrics() as Dictionary<string, Metrics?[]>, (long)Time.Elapsed.TotalMilliseconds);
+ return new(
+ (view.GetMetrics() as Dictionary<string, Metrics?[]>, (long)Time.Elapsed.TotalMilliseconds));
}
else
{
- return (ImmutableDictionary<string, Metrics?[]>.Empty, (long)Time.Elapsed.TotalMilliseconds);
+ return new((ImmutableDictionary<string, Metrics?[]>.Empty, (long)Time.Elapsed.TotalMilliseconds));
}
}
}
- public (IEnumerable<string>, IEnumerable<string>) GetMetricsViewNames(
+ public ValueTask<(IEnumerable<string>, IEnumerable<string>)> GetMetricsViewNamesAsync(
Current current,
CancellationToken cancel)
{
lock (_mutex)
{
- return (_views.Keys.ToArray(), _disabledViews.ToArray());
+ return new((_views.Keys.ToArray(), _disabledViews.ToArray()));
}
}
diff --git a/csharp/src/Ice/Process.cs b/csharp/src/Ice/Process.cs
index 250c38b9098..2372df1418f 100644
--- a/csharp/src/Ice/Process.cs
+++ b/csharp/src/Ice/Process.cs
@@ -1,25 +1,31 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
+using System;
using System.Threading;
+using System.Threading.Tasks;
namespace ZeroC.Ice
{
// Default implementation of the Process Admin facet.
- internal sealed class Process : IProcess
+ internal sealed class Process : IAsyncProcess
{
private readonly Communicator _communicator;
- public void Shutdown(Current current, CancellationToken cancel) => _ = _communicator.ShutdownAsync();
+ public ValueTask ShutdownAsync(Current current, CancellationToken cancel)
+ {
+ _ = _communicator.ShutdownAsync(); // we can't wait for shutdown to complete
+ return default;
+ }
- public void WriteMessage(string message, int fd, Current current, CancellationToken cancel)
+ public async ValueTask WriteMessageAsync(string message, int fd, Current current, CancellationToken cancel)
{
switch (fd)
{
case 1:
- System.Console.Out.WriteLine(message);
+ await Console.Out.WriteLineAsync(message).ConfigureAwait(false);
break;
case 2:
- System.Console.Error.WriteLine(message);
+ await Console.Error.WriteLineAsync(message).ConfigureAwait(false);
break;
}
}
diff --git a/csharp/src/Ice/PropertiesAdmin.cs b/csharp/src/Ice/PropertiesAdmin.cs
index a8b8f8b55d5..a8b5181de4b 100644
--- a/csharp/src/Ice/PropertiesAdmin.cs
+++ b/csharp/src/Ice/PropertiesAdmin.cs
@@ -3,11 +3,13 @@
using System;
using System.Collections.Generic;
using System.Threading;
+using System.Threading.Tasks;
namespace ZeroC.Ice
{
- // This partial interface extends the IPropertieAdmin interface generated from the Slice interface PropertiesAdmin.
- public partial interface IPropertiesAdmin
+ // This partial interface extends the IAsyncPropertieAdmin interface generated from the Slice interface
+ // PropertiesAdmin.
+ public partial interface IAsyncPropertiesAdmin
{
/// <summary>The Updated event is triggered when the communicator's properties are updated through a remote call
/// to the setProperties operation implemented by this Properties admin facet. The event's args include only the
@@ -16,7 +18,7 @@ namespace ZeroC.Ice
}
// Default implementation of the Properties Admin facet.
- internal sealed class PropertiesAdmin : IPropertiesAdmin
+ internal sealed class PropertiesAdmin : IAsyncPropertiesAdmin
{
public event EventHandler<IReadOnlyDictionary<string, string>>? Updated;
@@ -24,16 +26,19 @@ namespace ZeroC.Ice
private readonly Communicator _communicator;
private readonly ILogger _logger;
- public string GetProperty(string key, Current current, CancellationToken cancel) =>
- _communicator.GetProperty(key) ?? "";
+ public ValueTask<string> GetPropertyAsync(string key, Current current, CancellationToken cancel) =>
+ new(_communicator.GetProperty(key) ?? "");
- public IReadOnlyDictionary<string, string> GetPropertiesForPrefix(
+ public ValueTask<IReadOnlyDictionary<string, string>> GetPropertiesForPrefixAsync(
string prefix,
Current current,
CancellationToken cancel) =>
- _communicator.GetProperties(forPrefix: prefix);
+ new(_communicator.GetProperties(forPrefix: prefix));
- public void SetProperties(Dictionary<string, string> newProperties, Current current, CancellationToken cancel)
+ public ValueTask SetPropertiesAsync(
+ Dictionary<string, string> newProperties,
+ Current current,
+ CancellationToken cancel)
{
int? traceLevel = _communicator.GetPropertyAsInt("Ice.Trace.Admin.Properties");
@@ -73,6 +78,7 @@ namespace ZeroC.Ice
}
Updated?.Invoke(_communicator, newProperties);
+ return default;
}
internal PropertiesAdmin(Communicator communicator)
diff --git a/csharp/test/Ice/admin/TestI.cs b/csharp/test/Ice/admin/TestI.cs
index f50f9bae96d..ae7c1fbd5e8 100644
--- a/csharp/test/Ice/admin/TestI.cs
+++ b/csharp/test/Ice/admin/TestI.cs
@@ -80,7 +80,7 @@ namespace ZeroC.Ice.Test.Admin
// The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
var servant = new RemoteCommunicator(communicator);
- if (communicator.FindAdminFacet("Properties") is IPropertiesAdmin admin)
+ if (communicator.FindAdminFacet("Properties") is IAsyncPropertiesAdmin admin)
{
admin.Updated += (_, updates) => servant.Updated(updates);
}
diff --git a/csharp/test/Ice/alias/Test.ice b/csharp/test/Ice/alias/Test.ice
index 88cd35e0ab3..64c3e8b6098 100644
--- a/csharp/test/Ice/alias/Test.ice
+++ b/csharp/test/Ice/alias/Test.ice
@@ -2,6 +2,8 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//
+[[suppress-warning(reserved-identifier)]]
+
module ZeroC::Ice::Test::Alias
{
struct Struct1
diff --git a/csharp/test/Ice/defaultServant/MyObjectI.cs b/csharp/test/Ice/defaultServant/MyObjectI.cs
index a7a0769ab91..40163662120 100644
--- a/csharp/test/Ice/defaultServant/MyObjectI.cs
+++ b/csharp/test/Ice/defaultServant/MyObjectI.cs
@@ -1,12 +1,13 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
using System.Threading;
+using System.Threading.Tasks;
namespace ZeroC.Ice.Test.DefaultServant
{
public sealed class MyObject : IMyObject
{
- public void IcePing(Current current, CancellationToken cancel)
+ public ValueTask IcePingAsync(Current current, CancellationToken cancel)
{
string name = current.Identity.Name;
@@ -14,6 +15,7 @@ namespace ZeroC.Ice.Test.DefaultServant
{
throw new ObjectNotExistException();
}
+ return default;
}
public string GetName(Current current, CancellationToken cancel)
diff --git a/csharp/test/Ice/metrics/AllTests.cs b/csharp/test/Ice/metrics/AllTests.cs
index 77f202ae4bb..012b8d793a3 100644
--- a/csharp/test/Ice/metrics/AllTests.cs
+++ b/csharp/test/Ice/metrics/AllTests.cs
@@ -396,7 +396,7 @@ namespace ZeroC.Ice.Test.Metrics
TestHelper.Assert(serverProps != null && serverMetrics != null);
var update = new UpdateCallbackI(serverProps);
- ((IPropertiesAdmin)communicator.FindAdminFacet("Properties")!).Updated += (_, u) => update.Updated();
+ ((IAsyncPropertiesAdmin)communicator.FindAdminFacet("Properties")!).Updated += (_, u) => update.Updated();
var props = new Dictionary<string, string>();
diff --git a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs
index 97910c0bf44..2f18ccf7be6 100644
--- a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs
+++ b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs
@@ -43,24 +43,28 @@ namespace ZeroC.Ice.Test.Operations
}
// Override the Object "pseudo" operations to verify the operation mode.
- public bool IceIsA(string id, Current current, CancellationToken cancel)
+ public ValueTask<bool> IceIsAAsync(string id, Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(id);
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(id));
}
- public void IcePing(Current current, CancellationToken cancel) => TestHelper.Assert(current.IsIdempotent);
+ public ValueTask IcePingAsync(Current current, CancellationToken cancel)
+ {
+ TestHelper.Assert(current.IsIdempotent);
+ return default;
+ }
- public IEnumerable<string> IceIds(Current current, CancellationToken cancel)
+ public ValueTask<IEnumerable<string>> IceIdsAsync(Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetAllIceTypeIds();
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds());
}
- public string IceId(Current current, CancellationToken cancel)
+ public ValueTask<string> IceIdAsync(Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetIceTypeId()!;
+ return new(typeof(IMyDerivedClass).GetIceTypeId()!);
}
public ValueTask ShutdownAsync(Current current, CancellationToken cancel)
diff --git a/csharp/test/Ice/operations/MyDerivedClassI.cs b/csharp/test/Ice/operations/MyDerivedClassI.cs
index e9335f16ad6..334efc4a722 100644
--- a/csharp/test/Ice/operations/MyDerivedClassI.cs
+++ b/csharp/test/Ice/operations/MyDerivedClassI.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
+using System.Threading.Tasks;
using ZeroC.Test;
namespace ZeroC.Ice.Test.Operations
@@ -16,28 +17,31 @@ namespace ZeroC.Ice.Test.Operations
private int _opByteSOnewayCallCount;
// Override the Object "pseudo" operations to verify the operation mode.
- public bool IceIsA(string id, Current current, CancellationToken cancel)
+ public ValueTask<bool> IceIsAAsync(string id, Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(id);
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(id));
}
- public void IcePing(Current current, CancellationToken cancel) => TestHelper.Assert(current.IsIdempotent);
+ public ValueTask IcePingAsync(Current current, CancellationToken cancel)
+ {
+ TestHelper.Assert(current.IsIdempotent);
+ return default;
+ }
- public IEnumerable<string> IceIds(Current current, CancellationToken cancel)
+ public ValueTask<IEnumerable<string>> IceIdsAsync(Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetAllIceTypeIds();
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds());
}
- public string IceId(Current current, CancellationToken cancel)
+ public ValueTask<string> IceIdAsync(Current current, CancellationToken cancel)
{
TestHelper.Assert(current.IsIdempotent);
- return typeof(IMyDerivedClass).GetIceTypeId()!;
+ return new(typeof(IMyDerivedClass).GetIceTypeId()!);
}
- public void Shutdown(Current current, CancellationToken cancel) =>
- current.Communicator.ShutdownAsync();
+ public void Shutdown(Current current, CancellationToken cancel) => current.Communicator.ShutdownAsync();
// TODO check if compress is supported.
public bool SupportsCompress(Current current, CancellationToken cancel) => false;
diff --git a/csharp/test/Ice/proxy/MyDerivedClassAMDI.cs b/csharp/test/Ice/proxy/MyDerivedClassAMDI.cs
index fd130e6b6f1..772ed8d4ada 100644
--- a/csharp/test/Ice/proxy/MyDerivedClassAMDI.cs
+++ b/csharp/test/Ice/proxy/MyDerivedClassAMDI.cs
@@ -29,10 +29,10 @@ namespace ZeroC.Ice.Test.Proxy
CancellationToken cancel) =>
new(_ctx!);
- public bool IceIsA(string typeId, Current current, CancellationToken cancel)
+ public ValueTask<bool> IceIsAAsync(string typeId, Current current, CancellationToken cancel)
{
_ctx = current.Context;
- return typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(typeId);
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(typeId));
}
public async ValueTask<IRelativeTestPrx> OpRelativeAsync(
diff --git a/csharp/test/Ice/proxy/MyDerivedClassI.cs b/csharp/test/Ice/proxy/MyDerivedClassI.cs
index 11c2fe5d00c..2ba5db5f250 100644
--- a/csharp/test/Ice/proxy/MyDerivedClassI.cs
+++ b/csharp/test/Ice/proxy/MyDerivedClassI.cs
@@ -3,6 +3,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
+using System.Threading.Tasks;
+
using ZeroC.Test;
namespace ZeroC.Ice.Test.Proxy
@@ -20,10 +22,10 @@ namespace ZeroC.Ice.Test.Proxy
public IReadOnlyDictionary<string, string> GetContext(Current current, CancellationToken cancel) => _ctx!;
- public bool IceIsA(string typeId, Current current, CancellationToken cancel)
+ public ValueTask<bool> IceIsAAsync(string typeId, Current current, CancellationToken cancel)
{
_ctx = current.Context;
- return typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(typeId);
+ return new(typeof(IMyDerivedClass).GetAllIceTypeIds().Contains(typeId));
}
public IRelativeTestPrx OpRelative(ICallbackPrx callback, Current current, CancellationToken cancel)
diff --git a/csharp/test/IceBox/admin/TestServiceI.cs b/csharp/test/IceBox/admin/TestServiceI.cs
index a58e9effa2e..fcc87a3a908 100644
--- a/csharp/test/IceBox/admin/TestServiceI.cs
+++ b/csharp/test/IceBox/admin/TestServiceI.cs
@@ -18,7 +18,7 @@ namespace ZeroC.IceBox.Test.Admin
// The TestFacetI servant also implements PropertiesAdminUpdateCallback. Set the callback on the admin facet.
IObject? propFacet = serviceManagerCommunicator.FindAdminFacet("IceBox.Service.TestService.Properties");
- if (propFacet is IPropertiesAdmin admin)
+ if (propFacet is IAsyncPropertiesAdmin admin)
{
admin.Updated += (_, updates) => facet.Updated(updates);
}