AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API.
| Metric | Value |
|---|---|
| Total Examples | 1840 |
| Categories | 31 |
| Overall Pass Rate | 100.0% |
| Aspose.Diagram Version | 26.8.0 |
| Target Framework | net8.0 |
| Last Updated | 2026-08-31 |
agents.md ← AI agent instructions (root)
README.md ← This file
index.json ← Machine-readable catalogue
LICENSE ← MIT licence
.github/
workflows/
validate-pr.yml ← CI validation
basic-operations/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
convert-visio-document/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
diagram-conversions/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
diagram-vba/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
document-properties/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
drawing/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
events-section-in-the-shapesheet/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
font-operations/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
ole-objects-in-visio-diagram/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
page-setup-features/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
visio-activex-controls/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
visio-shape-gradient/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-comments/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-diagrams/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-external-data-sources/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-fields/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-geometry-section/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-headers-and-footers/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-hyperlinks/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-images/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-layers/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-masters/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-pages/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-protection/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-shapes/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-solutionxml-elements/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-text/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-text-boxes/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-themes/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-user-defined-cells/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
working-with-window-elements/
agents.md ← Category AI instructions
index.json ← Category catalogue
*.cs ← Example files
git clone https://github.com/aspose-diagram/agentic-net-examples.git
cd <category-folder>
# Copy any .cs file content into your project
# Ensure Aspose.Diagram.dll is referenced
dotnet build && dotnet run- .NET SDK (net8.0 or later)
- Aspose.Diagram for .NET 26.8.0
- DLL referenced in your
.csproj
| Attempt | Strategy | Trigger |
|---|---|---|
| 1 | MCP direct retrieval + code assembly | Always |
| 2 | MCP + injected API correction rules | Attempt 1 fails |
| 3 | LLM repair with compiler errors + rules | Attempt 2 fails |
Every PR is automatically validated by GitHub Actions:
dotnet build— required, blocks merge on failuredotnet run— informational only
Each Aspose.Diagram release gets its own set of PRs validated against that version's DLL. Examples are tagged by version in index.json.
Examples are generated automatically by the Aspose.Diagram Examples Generator Agent. To request new examples or report issues, open an issue on this repository. For AI agent instructions, see agents.md.
Aspose.Diagram for .NET is a class library for working with Microsoft Visio files programmatically in .NET applications. This repository demonstrates:
| Capability | Formats / Operations |
|---|---|
| Read Visio files | VSDX, VSD, VDX, VSX, VTX, VSSX, VSTX |
| Write Visio files | VSDX, VDX, VSDM, VSTM, VSSM |
| Export to image | PNG, JPEG, BMP, TIFF, EMF, SVG |
| Export to document | PDF, XPS, HTML, XAML |
| Shape operations | Add, modify, connect, style, group shapes |
| Page operations | Add, copy, move, resize, reorder pages |
| Theme operations | Apply preset themes and variants |
| Text operations | Add, update, format text in shapes |
| Data operations | User-defined cells, custom properties, external data |
| VBA operations | Read, modify, remove VBA projects |
How do I load a Visio file in C#?
using Aspose.Diagram;
Diagram diagram = new Diagram("input.vsdx");How do I convert a Visio diagram to PDF?
using Aspose.Diagram;
using Aspose.Diagram.Saving;
Diagram diagram = new Diagram("input.vsdx");
diagram.Save("output.pdf", new PdfSaveOptions());Why does using (Diagram diagram = ...) cause a compiler error?
Diagram does not implement IDisposable. Remove the using statement: Diagram diagram = new Diagram("input.vsdx");
Why does SaveFileFormat.VSDX cause CS0117?
SaveFileFormat enum members use PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf, SaveFileFormat.Png — never ALL_CAPS.
How do I add a shape to a Visio diagram?
long shapeId = diagram.AddShape(pinX, pinY, width, height, "masterName", 0);
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);How do I connect two shapes?
Shape connector = new Shape();
long connId = diagram.AddShape(connector, "Dynamic connector", 0);
diagram.Pages[0].ConnectShapesViaConnector(
shape1Id, ConnectionPointPlace.Right,
shape2Id, ConnectionPointPlace.Left, connId);All examples are compiler-validated before being committed. The benchmark is a 100% build pass rate across all generated examples.
| Version | Total Examples | Pass Rate | Framework |
|---|---|---|---|
| 26.8.0 | 1840 | 100.0% | net8.0 |
Pass rate is enforced by the agent pipeline — only examples that pass both dotnet build and dotnet run are committed to this repository.
Validation runs automatically on every pull request targeting main via GitHub Actions (.github/workflows/validate-pr.yml).
To trigger validation:
- Push your branch to GitHub
- Open a pull request targeting
main - GitHub Actions will automatically build and run all changed
.csfiles - Build failures block the merge — runtime errors are informational only
Maintained by agent-aspose-diagram-examples · Aspose.Diagram for .NET · 2026-08-31