localazure-service-fabricreliable-dictionary

Service Fabric: View contents of Reliable Dictionary while local debugging


Is there a way to view the contents of a reliable dictionary while local debugging. I can't find any property which gives me the contents.


Solution

  • You can't inspect a property, but you could call CreateEnumerableAsync to get an async enumerable.

    Sample:

    using (var tran = this.stateManager.CreateTransaction())
    {
        var asyncEnumerable = await yourDictionary.CreateEnumerableAsync(tran);
        var asyncEnumerator = asyncEnumerable.GetAsyncEnumerator();
        
        while (await asyncEnumerator.MoveNextAsync(cancelationToken))
        {
            log.Debug(asyncEnumerator.Current);
        }
    }