You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# .NET runtime no longer provides default SIGTERM signal handler
9
9
10
-
On Unix systems, .NET runtime no longer provides a default SIGTERM signal handler. On Windows, .NET runtime no longer provides default handlers for `CTRL_CLOSE_EVENT` and `CTRL_SHUTDOWN_EVENT` signals that are equivalents of Unix `SIGTERM` signal.
10
+
On Unix systems, the .NET runtime no longer provides a default SIGTERM signal handler. On Windows, the .NET runtime no longer provides default handlers for the [`CTRL_CLOSE_EVENT` and `CTRL_SHUTDOWN_EVENT` signals](/windows/console/handlerroutine), which are equivalents of Unix `SIGTERM` signal.
11
11
12
12
This change reverts the SIGTERM signal handling behavior to what it used to be in .NET Framework and classic Mono runtime.
13
13
@@ -17,33 +17,33 @@ This change reverts the SIGTERM signal handling behavior to what it used to be i
17
17
18
18
## Previous behavior
19
19
20
-
Previously, a SIGTERM signal handler registered by .NET runtime by default triggered graceful application exit. <xref:System.AppDomain.ProcessExit?displayProperty=nameWithType> and <xref:System.Runtime.Loader.AssemblyLoadContext.Unloading?displayProperty=nameWithType> events were raised before the application exited.
20
+
Previously, a SIGTERM signal handler registered by the .NET runtime by default triggered graceful application exit. <xref:System.AppDomain.ProcessExit?displayProperty=nameWithType> and <xref:System.Runtime.Loader.AssemblyLoadContext.Unloading?displayProperty=nameWithType> events were raised before the application exited.
21
21
22
22
## New behavior
23
23
24
-
Starting in .NET 10, .NET runtime does not override SIGTERM signal handling provided by the operating system. The typical default SIGTERM signal handler provided by the operating system terminates the application immediately. <xref:System.AppDomain.ProcessExit?displayProperty=nameWithType> and <xref:System.Runtime.Loader.AssemblyLoadContext.Unloading?displayProperty=nameWithType> events are not raised.
24
+
Starting in .NET 10, the .NET runtime does not override SIGTERM signal handling provided by the operating system. The typical default SIGTERM signal handler provided by the operating system terminates the application immediately. <xref:System.AppDomain.ProcessExit?displayProperty=nameWithType> and <xref:System.Runtime.Loader.AssemblyLoadContext.Unloading?displayProperty=nameWithType> events aren't raised.
25
25
26
26
## Type of breaking change
27
27
28
28
This is a [behavioral change](../../categories.md#behavioral-change).
29
29
30
30
## Reason for change
31
31
32
-
The SIGTERM signal handler registered by .NET runtime by default was both insufficient for some app models (for example, console and containerized applications) and incompatible with other app models (for example, Windows services). It's better to leave it to higherlevel libraries or application code to register signal handlers appropriate for the given app model.
32
+
The SIGTERM signal handler registered by the .NET runtime by default was both insufficient for some app models (for example, console and containerized applications) and incompatible with other app models (for example, Windows services). It's better to leave it to higher-level libraries or application code to register signal handlers appropriate for the given app model.
33
33
34
34
## Recommended action
35
35
36
-
- No action is necessary for typical ASP.NET applications or applications that use higherlevel APIs such as `HostingHostBuilderExtensions.UseConsoleLifetime` to handle app-model specific concerns. These higher-level APIs register handlers for SIGTERM and other signals as appropriate.
36
+
- No action is necessary for typical ASP.NET applications or applications that use higher-level APIs such as <xref:Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.UseConsoleLifetime*?displayProperty=nameWithType> to handle app-model specific concerns. These higher-level APIs register handlers for SIGTERM and other signals as appropriate.
37
37
38
-
-Applications that wish to handle SIGTERM signal without taking a dependency on higherlevel librariescan replicate the old behavior by creating a SIGTERM signal handler in their Main method using <xref:System.Runtime.InteropServices.PosixSignalRegistration.Create%2A?displayProperty=nameWithType> API:
38
+
-If you want to handle SIGTERM signal without taking a dependency on higher-level libraries, you can replicate the previous behavior by creating a SIGTERM signal handler in your `Main` method using the<xref:System.Runtime.InteropServices.PosixSignalRegistration.Create%2A?displayProperty=nameWithType> API:
0 commit comments