» Back to Documentation

How to debug your plugin .dll

Debugging is a very helpful and often necessary process to track down exactly whats going on inside your code and fix errors. Max.NET allows for native .NET application debugging and this document describes the easy steps to set up debugging for your project.

Step 1: Put your project into Debug configuration

A special Debug configuration is generated by Visual Studio (and other IDE's) that prepares your project for debugging. This preparation includes outputting debug symbols database file (.pdb) and disabling any code optimization and obfuscation. To begin debugging put your solution into debug configuration.

Select debug

Step 2: Set some breakpoints

It is often useful to set breakpoints in your code where you can observe the stack trace at a particular time and context in your code. The breakpoints are usually set in a critical part of the code that you want to test.

Set breakpoints

Step 3: Copy your assembly and symbol database to 3dsmax

To enable debugging you need to make sure that you copy the .pdb file along with your .dll file into the same directory.

Place files

Step 4: Start 3dsmax and attach process

Visual studio contains a special "Attach to process..." option in the debug menu. Use this to attach 3dsmax.exe process when it is running.

Attach to process

Step 5: Create your plugin in 3dsmax to hit breakpoint(s)

Once the executing  of code reaches one of the breakpoints you set (or an unhandled exception) you will see the breakpoint hit in your IDE. At this point you can browse the stack frame, stack trace, and perform modifications.

Breakpoint hit