Using Visual Studio to Debug iLogic Rules
Stepping Through iLogic Rules Line-by-Line

Visual Studio can be used to debug Autodesk Inventor iLogic rules, both internal and external, by attaching to the running Inventor process and triggering breakpoints in the rule code. This guide outlines a workflow for step-through debugging and variable inspection of iLogic rules.
Core Concepts
- iLogic rules execute inside the Inventor process.
- Visual Studio must attach to Inventor after it is already running.
- Breakpoints are triggered programmatically from within the rule, not pre-set in source files.
- Visual Studio opens a read-only temporary, runtime-generated file for debugging.
Attaching Visual Studio to Inventor
Step-By-Step
- Launch
Autodesk Inventor. - Open
Visual Studio, with or without code. - In
Visual Studio:- Navigate to
Debug=>Attach To Process - Set:
- Connection Type:
Local - Process:
Inventor.exe
- Connection Type:
- Click
Attach
- Navigate to
Expected Result
- Visual Studio is now listening to the Inventor process.
- No source code opens yet.
- Visual Studio will activate only when a breakpoint or exception is hit.
For Autodesk's official walkthrough, see: Using Visual Studio to Debug iLogic Rules
Debugging iLogic Rules
How It Works
- Inventor signals the debugger when execution reaches the breakpoint call.
- Visual Studio opens a temporary runtime version of the rule.
- Execution pauses on the break line.
- All local variables, objects, and the call stack are inspectable.
Internal iLogic Rules
Internal iLogic rules have a built-in keyword that acts as a breakpoint and triggers a pause in the execution.
Add the following line anywhere in the rule:
Break()
External iLogic Rules
External rules can have a similar method for the same functionality as the internal rules. These rules are compiled at runtime, allowing changes to take effect immediately without restarting Inventor.
Add the following method to the external rule class and call it anywhere in the rule:
''' <summary>
''' Allow external debugger to attach like a breakpoint.
''' </summary>
''' <remarks>
''' <see cref="System.Diagnostics.DebuggerStepThroughAttribute"/> attribute prevents stepping into the helper method itself.
''' </remarks>
<System.Diagnostics.DebuggerStepThrough>
Public Shared Sub Break()
If System.Diagnostics.Debugger.IsAttached Then
System.Diagnostics.Debugger.Break()
End If
End Sub
Resetting The iLogic Cache
iLogic can cache rules and store runtime state. The following command, which can be added to a separate rule, will force iLogic to release memory and reset its execution context.
Usage (When to Consider Resetting)
- Inconsistent internal rule behavior.
- Long debugging sessions.
ThisApplication.CommandManager.ControlDefinitions.OfType(Of ControlDefinition)() _ .FirstOrDefault(Function(c) c.InternalName = "iLogic.FreeILogicMemory") _ ?.Execute()
Common Pitfalls
- Forgetting to attach before executing the rules.
- Expecting breakpoints to persist between runs.
- Editing the temporary files opened by Visual Studio.
Summary
With a simple attach-to-process setup and deliberate breakpoint triggers, Visual Studio becomes a powerful debugging environment for iLogic development. This approach scales from quick rule inspection to larger external rule workflows and provides a consistent debugging experience for Inventor automation.



