I will show you how to debug your mod C# code use Visual Studio 2019.
1. Check Unity version of the game you have.
Let’s confirm the Look the [RIMWorld_Install_Path]\UnityPlayer.dll ‘s version information.
In this case, it use Unity 2019.2.17
2. Go
https://unity3d.com/get-unity/download/archive download correct version of unity.
In this case, we need download 2019.2.17. Choose Unity Editor 64-bit, the download will start automatically.
3. After download done, use 7zip unpack file.
In this case, the filename is UnitySetup64-2019.2.17f1.exe.
4. Copy your RIMWorld Game to C:\RIMWorld_Debug
5. Locate to [UnpackFolder]\Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win64_development_mono\
Copy UnityPlayer.dll and WinPixEventRuntime.dll to C:\RIMWorld_Debug and overwrite it.
Copy WindowsPlayer.exe to C:\RIMWorld_Debug, and rename to RimWorldWin64.exe
6. Delete Unpack Unity files. We no longer need them.
7. Use text editor open C:\RIMWorld_Debug\RimWorldWin64_Data\boot.config
Add:
wait-for-managed-debugger=1
player-connection-debug=1
8. Install Visual Studio 2019
Because I already installed VS2019 on my computer, I'm not sure what you need. I think you may need .Net desktop development Workloads.
The most important thing is, install Game development with Unity Wordloads, but you only need Visual Studio Tools for Unity. You don't need Optional Unity 2019.2 64-bit Editor, if you are not Unity developer.
9. After all 1-8 is done, then open you mod solution.
Set mod project properties (mouse right client on project name, at the bottom)
Build/Click Advance button/Change Output->Debugging information to Portable
10. Rebuild your mod, and place .dll and .pdb to C:\RIMWorld_Debug\Mods\your_mod\...
11. Run C:\RIMWorld_Debug\RimWorldWin64.exe, then you will see a dialog with message "You can attach a managed debugger now if you want"
12. Go to Visual Studio 2019, click menu Debug/Attach Unity Debugger
A "Select Unity instance" dialog will show you some thing like..
Project Machine Type Port Information
WindowsPlayer Your_PC_Name Player 56593 PID:xxxx
Double click on it, then attached to RIMWorld script debugger.
Now you can try to set break point on your mod code.