roslyn:validate_code
Validate C# code compilation without writing to disk. Check AI-generated code for errors before applying changes using Roslyn compiler analysis.
Instructions
Check if code would compile without writing to disk. Use to validate generated code before applying.
USAGE: validate_code(code="public void Foo() {}", contextFilePath="path/to/file.cs") to check with existing usings. OUTPUT: compiles (bool), errors list with line numbers. Essential before inserting AI-generated code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | C# code to validate | |
| contextFilePath | No | Optional: file to use for context (usings, namespace) | |
| standalone | No | If true, treat code as complete file (default: false) |