
ないならば、作ってしまおう、デバッガー ~VS Code 拡張編~ x86 の C# を VS Code で止めるIf It Doesn't Exist, Build It: A Debugger as a VS Code Extension for Breaking on x86 C#
- VS Code の C# 拡張が使う vsdbg は x64 と arm64 専用で、x86 ビルドは停止できない。
- そこで自作の拡張により 32 ビットの C# プロセスを止める方法を解説する。
- 32 ビットのミドルウェアを使う移行案件の開発者に役立つ。
The C# extension's vsdbg supports only x64 and arm64, so x86 builds cannot hit breakpoints. The author builds a custom VS Code extension to debug 32-bit C#, helping teams tied to 32-bit middleware.
AI 生成の要約と解説(解説は要約と収集メタデータに基づく)で、元記事全文の転載・翻訳ではありません。日本語版と英語版は言語ごとに独立して生成しています。正確性は元記事 (qiita.com) でご確認ください。AI-generated summary and explainer (the latter based on the summaries and collected metadata), not a copy or translation of the full source article. Generated independently for each language. Verify accuracy at the original source (qiita.com).
VS Code の C# 拡張に含まれるデバッガ vsdbg は x64 と arm64 にしか対応しておらず、x86 でビルドした C# プログラムはブレークポイントで止められない。この記事は、その制約にぶつかった筆者が自作の VS Code 拡張で 32 ビットのプロセスを止められるようにするまでを扱う。
32ビット案件での行き詰まり
筆者はユーザー系 SIer でアーキテクトを務める takahino 氏。既存システムを C# へ移行する案件で、使うミドルウェアが 32 ビットだったため、x86 でビルドする必要があった。開発は VS Code で行いたかったが、デバッグを始めてもブレークポイントで止まらなかったという。
プロジェクトを x86 にして F5 を押すと、vsdbg は処理を止めず、画面には「Only 64-bit processes can be debugged.」と表示される。筆者はこの状況を「とても悲しくなりました」と振り返っている。
ICorDebug のビット数条件
原因として挙げられているのは、.NET のデバッグに使われる ICorDebug の条件である。デバッガと対象プロセスのビット数が合っていなければならない。vsdbg には x64 版と arm64 版しかないため、32 ビットのプロセスは対象にできない。
公式の回答は「対象外」
Microsoft の C# 拡張の開発者は、公式リポジトリの issue で次のように答えている。「You aren't doing anything wrong. x86 debugging is not supported by the C# extension. You will need full Visual Studio for that.」つまり、操作に誤りはなく、x86 のデバッグは C# 拡張では対応していないので、それには Visual Studio 本体が必要だという趣旨である。
.NET の 32 ビットプロセスは対象外とされ、x64 で動くようにビルドし直すか、Visual Studio を使うよう案内されている。ただし今回の案件ではミドルウェアの都合で x86 ビルドが必須であり、どちらの案内にも沿いにくい状況だった。
なければ拡張を作る
そこで筆者は「ないならば、作ってしまおう」と考え、VS Code の拡張を自作する道を選んだ。記事の目的は、x86 のプロセスを VS Code の拡張から止められるようになるまでの過程を書くことである。32 ビットのミドルウェアに縛られた移行案件で、VS Code を開発環境にしたい開発者にとって、参考になる内容といえる。
Only 64-bit processes can be debugged
This article addresses a gap that affects developers who want to work in VS Code but must build C# projects for x86. The author, takahino, a SIer architect, found that breakpoints simply did not stop when debugging an x86 build, and decided to build a VS Code extension to solve it.
The situation arose during a project migrating an existing system to C#. The middleware in use was 32-bit, so the project had to be built for x86. The author wanted to develop in VS Code, but after starting a debug session, execution never halted at breakpoints.
vsdbg Supports Only x64 and arm64
According to the article, the debugger used by the C# extension, vsdbg, is available only for x64 and arm64. When the project is set to x86 and F5 is pressed, vsdbg does not stop the process, and the message "Only 64-bit processes can be debugged." appears on screen.
The article explains the cause in terms of .NET debugging through ICorDebug, which requires the debugger and the target process to have matching bitness. Since vsdbg exists only in x64 and arm64 versions, a 32-bit process cannot be stopped by it.
The Official Answer
The author cites a reply from a Microsoft C# extension developer in the official repository's issue tracker: "You aren't doing anything wrong. x86 debugging is not supported by the C# extension. You will need full Visual Studio for that."
As the article describes it, 32-bit .NET processes are outside the extension's scope. Users are directed either to rebuild the application to run as x64 or to use Visual Studio.
Building the Extension
Neither option suited the author's case, since the 32-bit middleware ruled out an x64 build and the goal was to stay in VS Code. The author therefore chose to write a VS Code extension of their own. The article sets out to document the path to the point where an x86 process can be stopped from a VS Code extension. For teams tied to 32-bit middleware in a migration to C#, that is the practical problem the piece takes on.
ポコとTECHガイドPoko & TECH Guide
ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.
- ポコPokox64とarm64にしか対応していなくて、x86だと止まらないんだね。これって大きいこと?So it only supports x64 and arm64, and x86 just won't stop at breakpoints? Is that a big deal?
- TECHガイドTECH Guide32ビットのミドルウェアを使う移行案件だと、x86ビルドが必須になるからね。この記事では、それでVS Codeのブレークポイントが効かず困った、という話だよ。It can be, yes. In this migration project, 32-bit middleware forced an x86 build, and VS Code's breakpoints stopped working. That's what sent the author looking for a fix.
- ポコPokoICorDebugって何?ビット数が合ってないと、なんでだめなの?What's ICorDebug? And why does the bit width have to match?
- TECHガイドTECH Guide.NETのデバッグに使う仕組み、くらいの意味だよ。記事だと、デバッガと対象のビット数が合う必要があって、vsdbgには32ビット版が無いと説明されているよ。Roughly, it's the mechanism for debugging .NET programs. The article says the debugger and target must match in bit width, and vsdbg has no 32-bit version.
- ポコPokoもし自分が同じ状況なら、拡張を自分で作るのかな。ほかに道はないのかな?If I were in the same spot, would I build my own extension? Are there other options?
- TECHガイドTECH Guide公式の回答では、x64でビルドし直すか、Visual Studioを使うよう案内されているよ。ミドルウェアが32ビットで動かせない場合に、自作拡張が選択肢になるんだと思う。The official reply points to rebuilding as x64 or using Visual Studio. A custom extension seems aimed at teams stuck with 32-bit middleware who still want VS Code.
匿名の公開いいねです。記事の保存・お気に入りではなく、Featured、Top 3、重要度、掲載順位には影響しません。仕組みとプライバシーAnonymous public likes are reactions, not saved articles or bookmarks. They do not affect Featured, Top 3, importance, or listing order.How it works and privacy



![[VSCode / SSH] リモートサーバに接続しようとした時に got bad result from install script と表示されてアクセスできない](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-afbab5eb44e0b055cce1258705637a91.png%3Fixlib%3Drb-4.1.1%26w%3D1200%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLXByb2ZpbGUtaW1hZ2VzLmltZ2l4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