[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BMRKH2MF07GD357PK5S4Q":3,"skill-same:01M69BMRKH2MF07GD357PK5S4Q":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":22,"linkOnly":23,"markdownContent":24,"markdownBody":25,"frontMatter":26,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M69BMRKH2MF07GD357PK5S4Q","windbg-user-mutex-held-across-co-await",null,"Use when app, service, or user-mode driver C++ coroutine code holds a thread-affine lock across suspension and later hangs or fails. Not for all coroutine crashes or choosing lock performance.","microsoft\u002Fwin-dev-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BM5T5HHSGVF6KZPTNENXK",510,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await\u002FSKILL.md",[],[19,20,21],"windbg user mutex held across co await","performance","code","2026-11-10 10:12:30",false,"---\nname: windbg-user-mutex-held-across-co-await\ndescription: 'Use when app, service, or user-mode driver C++ coroutine code holds a thread-affine lock across suspension and later hangs or fails. Not for all coroutine crashes or choosing lock performance.'\n---\n\n# Mutex Held Across co_await\n\n**Load `windbg-diagnostic-method` first** if it is not already loaded in this\nconversation, and apply it throughout for evidence ranking, hypothesis testing,\nconfidence calibration, independent review, and report validation. This skill\nadds the bug-family-specific commands and evidence requirements.\n\n## Detection\n\nThis pattern can occur in native application, service, or user-mode driver\ncode, including UMDF components that use C++ coroutines. Look for a lock\nacquired before `co_await` and released after resumption or\ncoroutine destruction. Mutex ownership belongs to the acquiring thread, not\nthe coroutine frame. A resumption on another thread can violate that contract.\nEven same-thread resumption can create reentrancy or progress problems when\nthe awaited operation needs a lock the coroutine still holds.\n\n## Workflow\n\n1. Identify the exact lock primitive and acquisition\u002Frelease scope in source.\n   Audit every suspension point while the RAII guard or ownership is alive.\n2. Establish the acquire and resume threads using trace\u002Fsource evidence.\n   Standard mutexes and SRW locks do not provide a universally queryable owner\n   field; do not fabricate an owning TID from undocumented layouts.\n3. Verify the awaiter's resumption contract. C++\u002FWinRT can preserve apartment\n   context for particular awaitables; `resume_background` intentionally switches.\n   Do not assume every WinRT awaitable always resumes on a worker or always on\n   the originating thread.\n4. Distinguish wrong-thread release, a dependency cycle, state changed during\n   suspension, lifetime failure, and unrelated memory corruption.\n5. Move the thread-affine lock into synchronous scopes. Revalidate relevant\n   state after the await rather than treating the pre-await snapshot as current.\n\nIf the symptom is general blocking use `windbg-user-wait-chain-analysis`. For damaged\nheap objects use `windbg-user-heap-corruption-investigation`. If a recording is available,\n`windbg-user-ttd-reverse-debugging-triage` can help establish the ownership timeline.\n\n## Fix pattern\n\nConceptual sequence, not a promise about any particular scheduler:\n\n```text\nunder lock:\n    take a snapshot and its generation\nrelease lock\nawait work using that snapshot\nunder lock on the resumed thread:\n    revalidate generation, lifetime, and assumptions\n    apply result or explicitly handle a stale\u002Fcancelled operation\nrelease lock\n```\n\nUse RAII for each synchronous scope. If invariants cannot tolerate unlocking,\nredesign the operation or use a specifically designed asynchronous coordination\nprimitive with cancellation\u002Flifetime rules. Switching to a recursive mutex or\n`shared_mutex` does not make a thread-affine lock coroutine-safe.\n\nDo not recommend a blanket mutex-type replacement. Shared locking is a separate\ndesign decision; changing the primitive does not repair suspension ownership.\nKeep the object and any captured interfaces alive across asynchronous work.\n\n## Validation\n\n- No thread-affine lock ownership survives a suspension in the corrected path.\n- Each awaiter's thread\u002Fapartment contract is understood.\n- State invariants are revalidated after suspension.\n- Cancellation, concurrent mutation, shutdown, and failed awaited work are tested.\n- The remedy removes the demonstrated cause, not just an observed exception.\n\n## References\n\n- [Holding a lock across coroutine suspension](https:\u002F\u002Fdevblogs.microsoft.com\u002Foldnewthing\u002F20210707-00\u002F?p=105417)\n- [C++\u002FWinRT concurrency and asynchronous operations](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fuwp\u002Fcpp-and-winrt-apis\u002Fconcurrency)\n- [Slim reader\u002Fwriter locks](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwin32\u002Fsync\u002Fslim-reader-writer--srw--locks)\n\n## Feedback\n\nFollow `FEEDBACK.md` and report reviewed, sanitized feedback to\n[WinDbg-Feedback](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FWinDbg-Feedback\u002Fissues).\nInclude `windbg-user-mutex-held-across-co-await` and the package version from `plugin.json`;\nno automatic source, dump, or transcript upload.\n","# Mutex Held Across co_await\n\n**Load `windbg-diagnostic-method` first** if it is not already loaded in this\nconversation, and apply it throughout for evidence ranking, hypothesis testing,\nconfidence calibration, independent review, and report validation. This skill\nadds the bug-family-specific commands and evidence requirements.\n\n## Detection\n\nThis pattern can occur in native application, service, or user-mode driver\ncode, including UMDF components that use C++ coroutines. Look for a lock\nacquired before `co_await` and released after resumption or\ncoroutine destruction. Mutex ownership belongs to the acquiring thread, not\nthe coroutine frame. A resumption on another thread can violate that contract.\nEven same-thread resumption can create reentrancy or progress problems when\nthe awaited operation needs a lock the coroutine still holds.\n\n## Workflow\n\n1. Identify the exact lock primitive and acquisition\u002Frelease scope in source.\n   Audit every suspension point while the RAII guard or ownership is alive.\n2. Establish the acquire and resume threads using trace\u002Fsource evidence.\n   Standard mutexes and SRW locks do not provide a universally queryable owner\n   field; do not fabricate an owning TID from undocumented layouts.\n3. Verify the awaiter's resumption contract. C++\u002FWinRT can preserve apartment\n   context for particular awaitables; `resume_background` intentionally switches.\n   Do not assume every WinRT awaitable always resumes on a worker or always on\n   the originating thread.\n4. Distinguish wrong-thread release, a dependency cycle, state changed during\n   suspension, lifetime failure, and unrelated memory corruption.\n5. Move the thread-affine lock into synchronous scopes. Revalidate relevant\n   state after the await rather than treating the pre-await snapshot as current.\n\nIf the symptom is general blocking use `windbg-user-wait-chain-analysis`. For damaged\nheap objects use `windbg-user-heap-corruption-investigation`. If a recording is available,\n`windbg-user-ttd-reverse-debugging-triage` can help establish the ownership timeline.\n\n## Fix pattern\n\nConceptual sequence, not a promise about any particular scheduler:\n\n```text\nunder lock:\n    take a snapshot and its generation\nrelease lock\nawait work using that snapshot\nunder lock on the resumed thread:\n    revalidate generation, lifetime, and assumptions\n    apply result or explicitly handle a stale\u002Fcancelled operation\nrelease lock\n```\n\nUse RAII for each synchronous scope. If invariants cannot tolerate unlocking,\nredesign the operation or use a specifically designed asynchronous coordination\nprimitive with cancellation\u002Flifetime rules. Switching to a recursive mutex or\n`shared_mutex` does not make a thread-affine lock coroutine-safe.\n\nDo not recommend a blanket mutex-type replacement. Shared locking is a separate\ndesign decision; changing the primitive does not repair suspension ownership.\nKeep the object and any captured interfaces alive across asynchronous work.\n\n## Validation\n\n- No thread-affine lock ownership survives a suspension in the corrected path.\n- Each awaiter's thread\u002Fapartment contract is understood.\n- State invariants are revalidated after suspension.\n- Cancellation, concurrent mutation, shutdown, and failed awaited work are tested.\n- The remedy removes the demonstrated cause, not just an observed exception.\n\n## References\n\n- [Holding a lock across coroutine suspension](https:\u002F\u002Fdevblogs.microsoft.com\u002Foldnewthing\u002F20210707-00\u002F?p=105417)\n- [C++\u002FWinRT concurrency and asynchronous operations](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fuwp\u002Fcpp-and-winrt-apis\u002Fconcurrency)\n- [Slim reader\u002Fwriter locks](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwin32\u002Fsync\u002Fslim-reader-writer--srw--locks)\n\n## Feedback\n\nFollow `FEEDBACK.md` and report reviewed, sanitized feedback to\n[WinDbg-Feedback](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FWinDbg-Feedback\u002Fissues).\nInclude `windbg-user-mutex-held-across-co-await` and the package version from `plugin.json`;\nno automatic source, dump, or transcript upload.\n",{"name":5,"description":7},"main","5ce74fa89c49ca353c6ab03bd5889aa519aa9e5e","plugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await",41,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-09 06:27:16",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await",{"tool":42,"command":43},"bunx","bunx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await",{"tool":45,"command":46},"pnpm","pnpm dlx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await\u002FSKILL.md",true,[],[51,69,77,87,98,106],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":65,"publishedAt":22},"01M69BN1YCR77KBJHPBB1KBXAB","sample-skill","Sample skill used to test the catalog tooling. Use when testing CI. Not for real work.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fscripts\u002Ftests\u002Ffixtures\u002Flocal-plugin\u002Fplugins\u002Fsample\u002Fskills\u002Fsample-skill\u002FSKILL.md",[57,62],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":63,"categoryName":64,"taxonomyType":60,"taxonomyTypeDesc":61},"01JBSEEDCAT000000000000023","Skill与智能体开发",[66,67,68],"sample skill","testing","test",{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":22},"01M69BMZFWAWBRE71DKPHT282F","windbg-user-wait-chain-analysis","Use when an app, service, or user-mode driver host is unresponsive on locks, COM\u002FRPC, I\u002FO, or another process; follow the blocker chain. Not for a crash solely from an exception stack.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-wait-chain-analysis\u002FSKILL.md",[],[76],"windbg user wait chain analysis",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":22},"01M69BMX6T725RH7TZK7RDP8YQ","windbg-user-virtual-memory-exhaustion","Use when a native app, service, or user-mode driver host allocation fails; distinguish VA exhaustion, fragmentation, and commit pressure. Not for managed .NET heap growth, proving a leak from one snapshot, or corruption.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-virtual-memory-exhaustion\u002FSKILL.md",[],[84,85,86],"windbg user virtual memory exhaustion","memory","commit",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":22},"01M69BMTTSCGTJ6W18YNYDWEVE","windbg-user-ttd-reverse-debugging-triage","Use when an app, service, or user-mode driver host TTD recording is available and earlier calls, writes, or lifetimes matter. Not for kernel replay or history from a normal dump.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-ttd-reverse-debugging-triage\u002FSKILL.md",[],[94,95,96,97],"debugging","windbg user ttd reverse debugging triage","triage","kernel",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":22},"01M69BMPFX7S3D729F1N89AAP6","windbg-user-heap-corruption-investigation","Use when an app, service, or user-mode driver host heap fails or Application Verifier detects corruption; inspect history and bounds. Not for kernel pool corruption or ordinary OOM.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-heap-corruption-investigation\u002FSKILL.md",[],[105,97],"windbg user heap corruption investigation",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":22},"01M69BMM5G8J8WJWKBWB6J0SA7","windbg-user-exception-triage","Use when a native C\u002FC++ app, service, or user-mode driver host (including UMDF) crashes with a structured exception in a dump or WinDbg session, including native faults inside managed processes. Not for managed .NET exceptions, WinUI\u002FXAML app errors, or kernel bugchecks.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-exception-triage\u002FSKILL.md",[],[113,96,97,114,115],"windbg user exception triage","xaml","winui"]