diff options
Diffstat (limited to 'src/csharp/Grpc.Core/GrpcEnvironment.cs')
-rw-r--r-- | src/csharp/Grpc.Core/GrpcEnvironment.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index 9c10a42e23..2e9e5a2ef6 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -86,6 +86,8 @@ namespace Grpc.Core { instance.Close(); instance = null; + + CheckDebugStats(); } } } @@ -132,5 +134,19 @@ namespace Grpc.Core // TODO: use proper logging here Console.WriteLine("GRPC shutdown."); } + + private static void CheckDebugStats() + { + var remainingClientCalls = DebugStats.ActiveClientCalls.Count; + if (remainingClientCalls != 0) + { + Console.WriteLine("Warning: Detected {0} client calls that weren't disposed properly.", remainingClientCalls); + } + var remainingServerCalls = DebugStats.ActiveServerCalls.Count; + if (remainingServerCalls != 0) + { + Console.WriteLine("Warning: Detected {0} server calls that weren't disposed properly.", remainingServerCalls); + } + } } } |