Skip to content

dnSpy

.NET debugger and assembly editor

Download

Guides

Setup

How to attach dnSpy to Bannerlord and catch the exception

  • Launch the Bannerlord launcher (not the game itself!)
  • Run dnSpy
  • In dnSpy, choose the command Debug - Attach to process...
  • Select the process corresponding to Bannerlord, then click Attach to confirm
  • If all goes well, you will see a "Running..." status confirming that dnSpy is attached to the Bannerlord process
  • Start the game. Play until a critical error occurs
  • You will see an error message on the screen

Source with pictures here by LogRaam

Not working breakpoints

In the module's .csproj file make sure you have

<TargetFramework>net472</TargetFramework>

and not

<TargetFramework>net472,netstandard2.0</TargetFramework>

or anything else. Recompile and should be ok.

Crash on the game start

Bad prefix/postfix argument:

    public static void Postfix(MenuCallbackArgs args)

    //should be:

    public static void Postfix()

What is interesting, game runs fine if not dnSpy attached.


Crash only when attached to the dnSpy.

The cause is RTS Camera mod. Disable it and game will start.

IL Instructions / OpCodes