dnSpy 32-bit vs 64-bit: Choosing Between dnSpy.exe and dnSpy-x86.exe

When to run the dnSpy 32-bit launcher, what the dnSpy exe files in the package do, and how process bitness affects debugging and attaching.

Two attach-to-process dialogs comparing 64-bit dnSpy.exe and 32-bit dnSpy-x86.exe

Open an extracted dnSpy folder and you will find more than one executable. Most people double-click dnSpy.exe and never think about the others, until the debugger refuses to attach to a program or a breakpoint silently does nothing. Nearly always, the cause is bitness. This guide explains what the dnSpy exe files are for, when the dnSpy 32-bit launcher is required, and how to tell which one a target program needs.

The executables in a dnSpy folder

The exact contents vary a little between packages and releases, but a typical folder contains:

FilePurpose
dnSpy.exeThe main application. In the 64-bit and .NET Framework packages it runs as a 64-bit process on 64-bit Windows.
dnSpy-x86.exeThe same application forced to run as a 32-bit process, so it can debug 32-bit programs.
dnSpy.Console.exeA command-line decompiler that writes assemblies out as source projects without opening the user interface.
*.exe.configConfiguration files for the launchers, used by the .NET Framework runtime.
bin\The libraries dnSpy is made of: decompiler, debugger engine, editor, extensions and their dependencies.

The .NET Framework package includes both dnSpy.exe and dnSpy-x86.exe in one folder. The self-contained packages are split by architecture instead: the win64 zip is the 64-bit edition, and the win32 zip is the 32-bit edition. If you need both architectures with the self-contained builds, extract each zip into its own folder.

Why bitness matters for debugging

Decompiling is pure file reading. A 64-bit dnSpy can decompile a 32-bit assembly and vice versa, because it is only parsing metadata and IL from disk. The architecture of the tool does not matter at all for browsing, searching, editing or saving assemblies.

Debugging is different. The .NET debugging interfaces that dnSpy uses work between processes of the same architecture. A 64-bit debugger cannot control the runtime inside a 32-bit process, and a 32-bit debugger cannot control a 64-bit one. When you start or attach to a program, its bitness decides which dnSpy launcher you must use.

Rule of thumb: decompile with whichever dnSpy you like; debug with the dnSpy that has the same bitness as the program you are debugging.

How to tell whether a program is 32-bit or 64-bit

For a running process

Open Task Manager, switch to the Details tab, right-click a column header, choose Select columns and enable Platform. Each process now shows “32 bit” or “64 bit”. dnSpy’s own Attach to Process dialog also lists the architecture of each managed process, which is the quickest check when you are already in the tool.

For a file on disk

Open the assembly in dnSpy and select the top node of the module in the Assembly Explorer. The header comments of the decompiled view show the architecture and runtime. You will see one of these situations:

  • x86: the program always runs as 32-bit. Use dnSpy-x86.exe.
  • x64: the program always runs as 64-bit. Use dnSpy.exe from a 64-bit package.
  • AnyCPU: the program runs as 64-bit on 64-bit Windows, unless the “32-bit preferred” flag is set.
  • AnyCPU, 32-bit preferred: the program runs as 32-bit even on 64-bit Windows. Use dnSpy-x86.exe. This is the default for many older desktop applications built in Visual Studio.

The “32-bit preferred” trap catches many people: the file says AnyCPU, so they assume 64-bit, but the process starts as 32-bit and the 64-bit debugger cannot follow it.

Common scenarios

Older WinForms or WPF desktop tools

Line-of-business applications built years ago frequently target x86, often because they depend on 32-bit native libraries such as old database drivers or COM components. Start them with dnSpy-x86.exe.

Modern .NET applications

Applications built on .NET 6 and later typically run as 64-bit on 64-bit Windows. The host executable decides the bitness, so check the process in Task Manager if unsure.

Unity games

Unity games ship as either 32-bit or 64-bit players. Look at the game folder: the architecture of UnityPlayer.dll and the name of the Mono folder usually make it clear. Debugging also requires a debug-enabled Mono runtime, as explained in the debugging guide.

Plug-ins loaded by another program

A plug-in DLL has no bitness of its own at runtime; it runs inside its host. If you need to debug a plug-in for a 32-bit host application, attach dnSpy-x86.exe to the host.

Using dnSpy-x86.exe in practice

  1. Close any instance of 64-bit dnSpy that has the same assemblies open, so the two do not fight over file locks when you save edits.
  2. Start dnSpy-x86.exe. Its title bar shows that it is the 32-bit edition.
  3. Use Debug › Start Debugging to launch the target, or Debug › Attach to Process to connect to one that is already running.
  4. Set breakpoints in the decompiled code as usual. Everything else, from the Locals window to module dumping, works the same as in the 64-bit edition.

Both launchers share the same settings, so your theme, decompiler options and open assembly list carry over.

Is the 32-bit edition slower or limited?

For everyday use the difference is hard to notice. The main limitation is memory: a 32-bit process can address at most around 4 GB on 64-bit Windows, and less on 32-bit Windows. If you open dozens of large assemblies, run broad searches across all of them, or export huge projects, the 64-bit edition copes better. Use the 32-bit edition for debugging x86 targets and keep the 64-bit edition for heavy browsing.

dnSpy.Console.exe for batch work

The console tool deserves a mention because it is often overlooked. It decompiles one or more assemblies into a folder of source files with a project file, from the command line. That makes it handy for scripted exports, for comparing two versions of a library with a diff tool, or for archiving readable source of a legacy component. Run it with no arguments to see its options:

dnSpy.Console.exe
dnSpy.Console.exe -o C:\export\Inventory C:\apps\Northwind.Inventory.dll

The console tool does not debug, so its bitness is irrelevant.

Troubleshooting bitness problems

“Cannot attach to the process” or the process is missing from the list

The target is almost certainly the other architecture. Switch launchers. If the target runs as administrator, dnSpy must also run as administrator to attach.

The program starts from dnSpy but breakpoints never hit

Check that the module containing your breakpoint actually loaded; the Modules window lists everything that has been loaded. If the code is optimised, enable the debugger options that suppress JIT optimisation and restart the program from dnSpy.

dnSpy-x86.exe does not exist in my folder

You are using a self-contained 64-bit package. Download the 32-bit self-contained package or the .NET Framework package and extract it into a separate folder.

A quick decision checklist

  • Only reading or editing code? Use any dnSpy, preferably the 64-bit one.
  • Debugging a process marked 32-bit in Task Manager? Use dnSpy-x86.exe.
  • Debugging a file marked x86 or “AnyCPU, 32-bit preferred”? Use dnSpy-x86.exe.
  • Debugging a 64-bit or plain AnyCPU program on 64-bit Windows? Use dnSpy.exe.
  • Exporting many assemblies to source? Use dnSpy.Console.exe.

Summary

The extra executables in a dnSpy folder are not duplicates. dnSpy.exe and dnSpy-x86.exe are the same tool in two architectures, and the debugger can only work with programs of matching bitness. Check the target’s platform in Task Manager or in dnSpy’s own headers, pick the matching launcher, and most “cannot attach” and “breakpoint not hit” problems disappear before they start.