aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs14
-rw-r--r--src/csharp/Grpc.Core/GrpcEnvironment.cs4
2 files changed, 12 insertions, 6 deletions
diff --git a/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs b/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
index e605a310f9..d2c641cf2f 100644
--- a/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
+++ b/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
@@ -32,13 +32,7 @@
#endregion
using System;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Threading;
using System.Threading.Tasks;
-using Grpc.Core;
-using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework;
@@ -46,6 +40,13 @@ namespace Grpc.Core.Tests
{
public class AppDomainUnloadTest
{
+#if DOTNET5_4
+ [Test]
+ [Ignore("Not supported for CoreCLR")]
+ public void AppDomainUnloadHookCanCleanupAbandonedCall()
+ {
+ }
+#else
[Test]
public void AppDomainUnloadHookCanCleanupAbandonedCall()
{
@@ -86,5 +87,6 @@ namespace Grpc.Core.Tests
readyToShutdown.Task.Wait(); // make sure handler is running
}
}
+#endif
}
}
diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs
index e9e4cb4cbb..37f9dce7c2 100644
--- a/src/csharp/Grpc.Core/GrpcEnvironment.cs
+++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs
@@ -352,8 +352,12 @@ namespace Grpc.Core
{
if (!hooksRegistered)
{
+ // TODO(jtattermusch): register shutdownhooks for CoreCLR as well
+#if !DOTNET5_4
+
AppDomain.CurrentDomain.ProcessExit += ShutdownHookHandler;
AppDomain.CurrentDomain.DomainUnload += ShutdownHookHandler;
+#endif
}
hooksRegistered = true;
}