mirror of https://github.com/dapr/dotnet-sdk.git
Merge pull request #1353 from WhitWaldo/get-metadata-fix
Added fix to handle null return values from GetMetadataAsync
This commit is contained in:
commit
19cb481557
|
@ -2390,10 +2390,14 @@ namespace Dapr.Client
|
|||
try
|
||||
{
|
||||
var response = await client.GetMetadataAsync(new Autogenerated.GetMetadataRequest(), options);
|
||||
return new DaprMetadata(response.Id,
|
||||
response.ActorRuntime.ActiveActors.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList(),
|
||||
response.ExtendedMetadata.ToDictionary(c => c.Key, c => c.Value),
|
||||
response.RegisteredComponents.Select(c => new DaprComponentsMetadata(c.Name, c.Type, c.Version, c.Capabilities.ToArray())).ToList());
|
||||
return new DaprMetadata(response.Id ?? "",
|
||||
response.ActorRuntime?.ActiveActors?.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList() ??
|
||||
new List<DaprActorMetadata>(),
|
||||
response.ExtendedMetadata?.ToDictionary(c => c.Key, c => c.Value) ??
|
||||
new Dictionary<string, string>(),
|
||||
response.RegisteredComponents?.Select(c =>
|
||||
new DaprComponentsMetadata(c.Name, c.Type, c.Version, c.Capabilities.ToArray())).ToList() ??
|
||||
new List<DaprComponentsMetadata>());
|
||||
}
|
||||
catch (RpcException ex)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Dapr.Client
|
||||
|
|
Loading…
Reference in New Issue