dont register shutdownhooks for dotnet5.4

pull/6104/head
Jan Tattermusch 9 years ago
parent a6c9a9121e
commit 635fafc398
  1. 14
      src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs
  2. 4
      src/csharp/Grpc.Core/GrpcEnvironment.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
}
}

@ -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;
}

Loading…
Cancel
Save