thread-abort-migration
Installation
SKILL.md
Thread.Abort Migration
This skill helps an agent migrate .NET Framework code that uses Thread.Abort to the cooperative cancellation model required by modern .NET (6+). Thread.Abort throws PlatformNotSupportedException in modern .NET — there is no way to forcibly terminate a managed thread. The skill identifies the usage pattern first, then applies the correct replacement strategy.
When to Use
- Migrating a .NET Framework project to .NET 6+ that calls
Thread.Abort - Replacing
ThreadAbortExceptioncatch blocks that use control flow or cleanup logic - Removing
Thread.ResetAbortcalls that cancel pending aborts - Replacing
Thread.Interruptfor waking blocked threads - Migrating ASP.NET code that uses
Response.EndorResponse.Redirect(url, true), which internally callThread.Abort - Resolving
PlatformNotSupportedExceptionorSYSLIB0006warnings after a target framework change
When Not to Use
- The code only uses
Thread.Join,Thread.Sleep, orThread.Startwithout any abort, interrupt, orThreadAbortExceptioncatch blocks. These APIs work identically in modern .NET — no migration is needed. Stop here and tell the user no migration is required. If you suggest modernization (e.g.,Task.Run,Parallel.ForEach), you must explicitly state these are optional improvements unrelated to Thread.Abort migration, and the existing code will compile and run correctly as-is on the target framework. - The project will remain on .NET Framework indefinitely
- The Thread.Abort usage is inside a third-party library you do not control