Token导航 LogoToken导航

Agent Skill · 研究检索

thread-abort-migration(线程中止迁移)

thread-abort-migration 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

thread-abort-migration 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 21,536。

总安装 4,845周安装 206GitHub Stars 1,534下载 1,697核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:thread-abort-migration(线程中止迁移)
来源仓库:https://github.com/dotnet/skills
仓库路径:skills/thread-abort-migration
安装命令:
npx skills add https://github.com/dotnet/skills --skill thread-abort-migration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dotnet/skills --skill thread-abort-migration

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选线程中止迁移相关的编程实践或技术文档。适合多线程应用中的资源释放、状态回滚等场景参考。可按编程语言(如 Java、C#)筛选结果,提升针对性。

安装命令:npx skills add https://github.com/dotnet/skills --skill thread-abort-migration。需注意不同运行时环境下线程管理的差异性。

来源仓库内路径:skills/thread-abort-migration

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dotnet/skills --skill thread-abort-migration;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

thread-abort-migration 怎么安装?

在终端执行 npx skills add https://github.com/dotnet/skills --skill thread-abort-migration。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

thread-abort-migration 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

thread-abort-migration 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

thread-abort-migration 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

thread-abort-migration 用的人多吗?

公开数据是累计安装 4,845 次,近一周安装 206 次,下载 1,697 次,GitHub 1,534 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

thread-abort-migration 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 1,534 星,维护活跃度相对可查。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
thread-abort-migration

线程中止迁移 · 本页

4,8451,534需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

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 ThreadAbortException catch blocks that use control flow or cleanup logic
  • Removing Thread.ResetAbort calls that cancel pending aborts
  • Replacing Thread.Interrupt for waking blocked threads
  • Migrating ASP.NET code that uses Response.End or Response.Redirect(url, true), which internally call Thread.Abort
  • Resolving PlatformNotSupportedException or SYSLIB0006 warnings after a target framework change

When Not to Use

  • The code only uses Thread.Join, Thread.Sleep, or Thread.Start without any abort, interrupt, or ThreadAbortException catch 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

Inputs

InputRequiredDescription
Source project or solutionYesThe.NET Framework project containing Thread.Abort usage
Target frameworkYesThe modern.NET version to target (e.g., net8.0)
Thread.Abort usage locationsRecommendedFiles or classes that reference Thread.Abort, ThreadAbortException, Thread.ResetAbort, or Thread.Interrupt

Workflow

Commit strategy: Commit after each pattern replacement so the migration is reviewable and bisectable. Group related call sites (e.g., all cancellable work loops) into one commit.

Step 1: Inventory all thread termination usage

Search the codebase for all thread-termination-related APIs:

  • Thread.Abort and thread.Abort() (instance calls)
  • ThreadAbortException in catch blocks
  • Thread.ResetAbort
  • Thread.Interrupt
  • Response.End() (calls Thread.Abort internally in ASP.NET Framework)
  • Response.Redirect(url, true) (the true parameter triggers Thread.Abort)
  • SYSLIB0006 pragma suppressions

Record each usage location and classify the intent behind the abort.

Step 2: Classify each usage pattern

Categorize every usage into one of the following patterns:

PatternDescriptionModern replacement
Cancellable work loopThread running a loop that should stop on demandCancellationToken checked in the loop
Timeout enforcementAborting a thread that exceeds a time limitCancellationTokenSource.CancelAfter or Task.WhenAny with a delay
Blocking call interruptionThread blocked on Sleep, WaitOne, or Join that needs to wake upWaitHandle.WaitAny with CancellationToken.WaitHandle, or async alternatives
ASP.NET request terminationResponse.End or Response.Redirect(url, true)Return from the action method; use HttpContext.RequestAborted
ThreadAbortException as control flowCatch blocks that inspect ThreadAbortException to decide cleanup actionsCatch OperationCanceledException instead, with explicit cleanup
Thread.ResetAbort to continue executionCatching the abort and calling ResetAbort to keep the thread aliveCheck CancellationToken.IsCancellationRequested and decide whether to continue
Uncooperative code terminationKilling a thread running code that cannot be modified to check for cancellationMove the work to a separate process and use Process.Kill

Critical: The fundamental paradigm shift is from preemptive cancellation (the runtime forcibly injects an exception) to cooperative cancellation (the code must voluntarily check for and respond to cancellation requests). Every call site must be evaluated for whether the target code can be modified to cooperate.

Step 3: Apply the replacement for each pattern

  • Cancellable work loop: Add a CancellationToken parameter. Replace the loop condition or add token.ThrowIfCancellationRequested() at safe checkpoints. The caller creates a CancellationTokenSource and calls Cancel() instead of Thread.Abort().
  • Timeout enforcement: Use new CancellationTokenSource(TimeSpan.FromSeconds(n)) or cts.CancelAfter(timeout). Pass the token to the work. For task-based code, use Task.WhenAny(workTask, Task.Delay(timeout, cts.Token)) and cancel the source if the delay wins; cancelling also disposes the delay's internal timer.
  • Blocking call interruption: Replace Thread.Sleep(ms) with Task.Delay(ms, token) or token.WaitHandle.WaitOne(ms). Replace ManualResetEvent.WaitOne() with WaitHandle.WaitAny(new[] {event, token.WaitHandle}).
  • ASP.NET request termination: Remove Response.End() entirely — just return from the method. Replace Response.Redirect(url, true) with Response.Redirect(url) (without the true endResponse parameter) or return a redirect result. In ASP.NET Core, use HttpContext.RequestAborted as the cancellation token for long-running request work.
  • ThreadAbortException as control flow: Replace catch (ThreadAbortException) with catch (OperationCanceledException). Move cleanup logic to finally blocks or CancellationToken.Register callbacks. Do not catch OperationCanceledException and swallow it — let it propagate unless you have a specific recovery action.
  • Thread.ResetAbort to continue execution: Break up "abortable" units of work so that cancellation in a processing loop can continue to the next unit instead of relying on ResetAbort to prevent tearing down the thread. Check token.IsCancellationRequested after each unit and decide whether to continue. Create a new CancellationTokenSource (optionally linked to a parent token) for each new unit of work rather than trying to reset an existing one.
  • Uncooperative code termination: If the code cannot be modified to accept a CancellationToken (e.g., third-party library, native call), move the work to a child process. The host process communicates via stdin/stdout or IPC and calls Process.Kill if a timeout expires.

Step 4: Clean up removed APIs

After migrating all patterns, remove or replace any remaining references:

Removed APIReplacement
Thread.Abort()CancellationTokenSource.Cancel()
ThreadAbortException catch blocksOperationCanceledException catch blocks
Thread.ResetAbort()Check token.IsCancellationRequested and decide whether to continue
Thread.Interrupt()Signal via CancellationToken or set a ManualResetEventSlim (also obsolete: SYSLIB0046 in.NET 9)
Response.End()Remove the call; return from the method
Response.Redirect(url, true)Response.Redirect(url) without endResponse, or return a redirect result
#pragma warning disable SYSLIB0006Remove after replacing the Thread.Abort call

Step 5: Verify the migration

  1. Build the project targeting the new framework. Confirm zero SYSLIB0006 warnings and no Thread.Abort-related compile errors.
  2. Search the codebase for any remaining references to Thread.Abort, ThreadAbortException, Thread.ResetAbort, or Thread.Interrupt.
  3. Run existing tests. If tests relied on Thread.Abort for cleanup or timeout, update them to use CancellationToken.
  4. For timeout scenarios, verify that work actually stops within a reasonable time after cancellation is requested.
  5. For blocking call scenarios, verify that blocked threads wake up promptly when the token is cancelled.

Validation

  • No references to Thread.Abort remain in the migrated code
  • No ThreadAbortException catch blocks remain
  • No Thread.ResetAbort calls remain
  • No SYSLIB0006 pragma suppressions remain
  • Project builds cleanly against the target framework with no thread-abort-related warnings
  • All cancellable work accepts a CancellationToken parameter
  • Timeout scenarios use CancellationTokenSource.CancelAfter or equivalent
  • Blocking calls use WaitHandle.WaitAny with token.WaitHandle or async alternatives
  • Existing tests pass or have been updated for cooperative cancellation

Common Pitfalls

PitfallSolution
Adding CancellationToken parameter but never checking it in long-running codeInsert token.ThrowIfCancellationRequested() at regular checkpoints in loops and between expensive operations. Cancellation only works if the code cooperates.
Not passing the token through the full call chainEvery async or long-running method in the chain must accept and forward the CancellationToken. If one method in the chain ignores it, cancellation stalls at that point.
Expecting CancellationToken to interrupt blocking synchronous calls like Thread.Sleep or socket.ReceiveThese calls do not check the token. Replace Thread.Sleep(ms) with token.WaitHandle.WaitOne(ms). Replace synchronous I/O with async overloads that accept a CancellationToken.
Catching OperationCanceledException and swallowing itLet OperationCanceledException propagate to the caller. Only catch it at the top-level orchestration point where you decide what to do after cancellation (log, clean up, return a result).
Not disposing CancellationTokenSourceCancellationTokenSource is IDisposable. Wrap it in a using statement or dispose it in a finally block. Leaking it causes timer and callback leaks.
Assuming cancellation is immediateCooperative cancellation only takes effect at the next checkpoint. If work items are large or the code has long gaps between checks, cancellation may be delayed. Design checkpoint frequency based on acceptable latency.
Using Thread.Interrupt as a substitute for Thread.AbortThread.Interrupt is also not recommended in modern.NET. It only works on threads in WaitSleepJoin state and throws ThreadInterruptedException, which is a different exception type. Replace with CancellationToken signaling.
Removing ThreadAbortException catch blocks without migrating the cleanup logicThreadAbortException catch blocks often contained critical cleanup (releasing locks, rolling back transactions). Move this logic to finally blocks or CancellationToken.Register callbacks before removing the catch.

More Info

平台分布

Codex

35.05%
按下载量换算595

Claude

30.49%
按下载量换算517

Cursor

19.48%
按下载量换算331

Gemini CLI

9.32%
按下载量换算158

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills