diff --git a/src/csharp/Grpc.Core.Api/ServerCallContext.cs b/src/csharp/Grpc.Core.Api/ServerCallContext.cs index 7cc03cb3a0b..8d7dbf544d6 100644 --- a/src/csharp/Grpc.Core.Api/ServerCallContext.cs +++ b/src/csharp/Grpc.Core.Api/ServerCallContext.cs @@ -120,18 +120,7 @@ namespace Grpc.Core /// Gets a dictionary that can be used by the various interceptors and handlers of this /// call to store arbitrary state. /// - public virtual IDictionary UserState - { - get - { - if (userState == null) - { - userState = new Dictionary(); - } - - return userState; - } - } + public IDictionary UserState => UserStateCore; /// Provides implementation of a non-virtual public member. protected abstract Task WriteResponseHeadersAsyncCore(Metadata responseHeaders); @@ -157,5 +146,18 @@ namespace Grpc.Core protected abstract WriteOptions WriteOptionsCore { get; set; } /// Provides implementation of a non-virtual public member. protected abstract AuthContext AuthContextCore { get; } + /// Provides implementation of a non-virtual public member. + protected virtual IDictionary UserStateCore + { + get + { + if (userState == null) + { + userState = new Dictionary(); + } + + return userState; + } + } } }