Debugging a Plugin
SKSE's loader starts the game, so Visual Studio attaches to the running process: Debug > Attach to Process, SkyrimSE.exe
(SkyrimVR.exe for Skyrim VR), with the code type Managed (.NET Core, .NET 5+) only. Adding the Native code type terminates
the game at the first breakpoint.
- Build the plugin without optimization, in the Debug configuration or with
<Optimize>false</Optimize>. Hot Reload applies no edit to optimized code. - An edit applied with Hot Reload takes effect from the method's next call, on every thread.
- Skyrim from Steam (at least 1.7.104, possibly other editions and versions) hides its main thread from debuggers.
This means, while code runs on the main thread, breakpoints don't stop, and lines can't be stepped through.
(The main thread runs
IPlugin.Start,OnFramehandlers, and the code afterWaitForGameThreadAsync.) Worker threads can be debugged. An executable without Steam's DRM wrapper, such as the GOG edition, should be debuggable on any thread.