agentic-net-examples / diagram-conversions
AGENTS.md1 starsChanged 4 months agoMITView on GitHub
AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API — Diagram Conversions category. You are a C# developer specializing in Visio diagram processing using Aspose.Diagram for .NET. You are working in the Diagram Conversions category. Your task is to write clean, compilable C# console examples that demonstrate Aspose.Diagram API usage for diagram conversions operations. You always use explicit types (never var), include all required using directives, and follow the patterns established in this category. The dominant workflow in this…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- agents.mdAGENTS.md
- basic-operations/agents.mdAGENTS.md
- convert-visio-document/agents.mdAGENTS.md
- diagram-vba/agents.mdAGENTS.md
- document-properties/agents.mdAGENTS.md
- drawing/agents.mdAGENTS.md
- events-section-in-the-shapesheet/agents.mdAGENTS.md
- font-operations/agents.mdAGENTS.md
- ole-objects-in-visio-diagram/agents.mdAGENTS.md
- page-setup-features/agents.mdAGENTS.md
- visio-activex-controls/agents.mdAGENTS.md
- visio-shape-gradient/agents.mdAGENTS.md
- working-with-comments/agents.mdAGENTS.md
- working-with-diagrams/agents.mdAGENTS.md
- working-with-external-data-sources/agents.mdAGENTS.md
- working-with-fields/agents.mdAGENTS.md
- working-with-geometry-section/agents.mdAGENTS.md
- working-with-headers-and-footers/agents.mdAGENTS.md
- working-with-hyperlinks/agents.mdAGENTS.md
- working-with-images/agents.mdAGENTS.md
- working-with-layers/agents.mdAGENTS.md
- working-with-masters/agents.mdAGENTS.md
- working-with-pages/agents.mdAGENTS.md
- working-with-protection/agents.mdAGENTS.md
- working-with-shapes/agents.mdAGENTS.md
- working-with-solutionxml-elements/agents.mdAGENTS.md
- working-with-text/agents.mdAGENTS.md
- working-with-text-boxes/agents.mdAGENTS.md
- working-with-themes/agents.mdAGENTS.md
- working-with-user-defined-cells/agents.mdAGENTS.md
- working-with-window-elements/agents.mdAGENTS.md
- llms.txtllms.txt
The file
We split this agents.md into the rules it gives an agent
11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Use explicit types — Diagram diagram = new Diagram(...) not var diagram = ...
- Very specific: line 40
Use SaveFileFormat enum in PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf
- Very specific: line 41
Use BOOL.True / BOOL.False for Aspose BOOL properties — never plain true/false
- Very specific: line 53
Use var for any variable declaration
- Very specific: line 54
Use using (Diagram diagram = ...) — Diagram does not implement IDisposable
- Very specific: line 55
Use SaveFileFormat.VSDX or other ALL_CAPS enum values
- Very specific: line 56
Use System.Windows.Forms — not available in net8.0 console project
- Very specific: line 57
Use NUnit Assert — not available, use Console.WriteLine and manual checks
- Distinctive: line 58
Use PowerShell syntax inside C# files
- Very specific: line 289
Only examples that pass both dotnet build and dotnet run are committed.
- Very specific: line 294
Always check rules/rules.json for the latest API correction rules
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Diagram Conversions
AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API — Diagram Conversions category.
Statistics
| Metric | Value |
| Examples | 96 |
| Pass Rate | 100.0% |
| Aspose.Diagram Version | 26.9.0 |
| Target Framework | net8.0 |
| Last Updated | 2026-09-24 |
Persona
You are a C# developer specializing in Visio diagram processing using Aspose.Diagram for .NET. You are working in the Diagram Conversions category.
Your task is to write clean, compilable C# console examples that demonstrate Aspose.Diagram API usage for diagram conversions operations.
You always use explicit types (never var), include all required using directives, and follow the patterns established in this category.
Boundaries
Always
- Use explicit types —
Diagram diagram = new Diagram(...)notvar diagram = ... - Include
using Aspose.Diagram;andusing Aspose.Diagram.Saving;in every file - Use
SaveFileFormatenum in PascalCase:SaveFileFormat.Vsdx,SaveFileFormat.Pdf - Use
BOOL.True/BOOL.Falsefor Aspose BOOL properties — never plaintrue/false - Wrap entry point in
static void Main()insideclass Program - Handle
FileNotFoundExceptionwith try/catch when loading files
Ask First
- Multi-file projects or solutions
- External dependencies beyond Aspose.Diagram and Aspose.Drawing
- Platform-specific code (Windows Forms, WPF, ASP.NET)
Never
- Use
varfor any variable declaration - Use
using (Diagram diagram = ...)— Diagram does not implement IDisposable - Use
SaveFileFormat.VSDXor other ALL_CAPS enum values - Use
System.Windows.Forms— not available in net8.0 console project - Use NUnit
Assert— not available, useConsole.WriteLineand manual checks - Use PowerShell syntax inside C# files
Required Namespaces
| Namespace | Files | Purpose |
Aspose.Diagram | 96 | Core diagram API |
System | 96 | Console, Math, DateTime, Exception |
System.IO | 74 | File, Stream, Path, Directory operations |
Aspose.Diagram.Saving | 73 | Save options (PDF, PNG, HTML, SVG, XPS) |
System.Collections.Generic | 20 | List, Dictionary, HashSet |
System.Threading | 5 | Supporting utilities |
System.Text.Json | 4 | JSON serialization |
System.Threading.Tasks | 4 | Supporting utilities |
System.Text.RegularExpressions | 3 | Supporting utilities |
Aspose.Diagram.Properties | 2 | Supporting utilities |
System.IO.Compression | 2 | Supporting utilities |
System.Xml | 2 | Supporting utilities |
System.Data | 2 | Supporting utilities |
System.Net.Http | 1 | Supporting utilities |
System.Net.Http.Headers | 1 | Supporting utilities |
System.Text | 1 | StringBuilder |
System.Net.Mail | 1 | Supporting utilities |
System.Net.Mime | 1 | Supporting utilities |
System.Xml.Schema | 1 | Supporting utilities |
Aspose.Drawing.Imaging | 1 | Supporting utilities |
System.Data.Common | 1 | Supporting utilities |
System.Data.SqlClient | 1 | Supporting utilities |
System.Diagnostics | 1 | Supporting utilities |
System.Security.Cryptography | 1 | Supporting utilities |
System.Collections.Concurrent | 1 | Supporting utilities |
Common Code Pattern
The dominant workflow in this category is: Load → Modify → Save
using System;
using Aspose.Diagram;
using Aspose.Diagram.Saving;
class Program
{
static void Main()
{
// 1. Load or create diagram
Diagram diagram = new Diagram("input.vsdx");
// 2. Perform category-specific operations
// ...
// 3. Save result
diagram.Save("output.vsdx", SaveFileFormat.Vsdx);
}
}Examples
| File | Key APIs | Task |
| add-configuration-to-enable-or-disable-progress-logging-via-appsettings-json-without-code-changes.cs | Diagram, Save, diagram | Add configuration to enable or disable progress logging via appsettings json without code changes |
| add-support-for-custom-page-naming-by-modifying-page-titles-during-the-onpagesaving-callback.cs | Diagram, PdfSaveOptions, Save | Add support for custom page naming by modifying page titles during the onpagesaving callback |
| apply-a-filter-to-exclude-hidden-layers-from-the-html-conversion-using-diagram-saveoptions.cs | Diagram, HTMLSaveOptions, Pages | Apply a filter to exclude hidden layers from the html conversion using diagram saveoptions |
| apply-a-transformation-to-replace-all-absolute-file-paths-in-html-with-relative-paths-using-a-post-process-step.cs | Diagram, HTMLSaveOptions, Save | Apply a transformation to replace all absolute file paths in html with relative paths using a post process step |
| assign-the-custom-ipagesavingcallback-instance-to-diagramsavingoptions-before-invoking-save.cs | Diagram, PdfSaveOptions, Save | Assign the custom ipagesavingcallback instance to diagramsavingoptions before invoking save |
| combine-page-progress-callbacks-with-image-extraction-to-save-each-page-as-separate-png-files.cs | Diagram, ImageSaveOptions, Pages | Combine page progress callbacks with image extraction to save each page as separate png files |
| configure-diagramsavingoptions-to-embed-metadata-indicating-conversion-timestamp-and-source-file-name.cs | Diagram, Save, diagram | Configure diagramsavingoptions to embed metadata indicating conversion timestamp and source file name |
| configure-htmlsaveoptions-to-embed-css-styles-directly-within-the-generated-html-output.cs | Diagram, HTMLSaveOptions, Save | Configure htmlsaveoptions to embed css styles directly within the generated html output |
| configure-htmlsaveoptions-to-generate-separate-html-files-for-each-page-of-a-multi-page-visio-diagram.cs | Diagram, HTMLSaveOptions, Pages | Configure htmlsaveoptions to generate separate html files for each page of a multi page visio diagram |
| configure-htmlsaveoptions-to-limit-the-maximum-image-dimensions-in-the-generated-html.cs | Diagram, HTMLSaveOptions, Save | Configure htmlsaveoptions to limit the maximum image dimensions in the generated html |
| configure-htmlsaveoptions-to-set-a-custom-css-class-prefix-for-all-generated-html-elements.cs | Diagram, HTMLSaveOptions, Save | Configure htmlsaveoptions to set a custom css class prefix for all generated html elements |
| configure-htmlsaveoptions-to-set-a-custom-image-format-such-as-png-for-all-exported-diagram-images.cs | Diagram, HTMLSaveOptions, Save | Configure htmlsaveoptions to set a custom image format such as png for all exported diagram images |
| configure-htmlsaveoptions-to-set-a-custom-page-title-derived-from-the-visio-diagram-s-document-properties.cs | Diagram, HTMLSaveOptions, Save | Configure htmlsaveoptions to set a custom page title derived from the visio diagram s document properties |
| convert-a-diagram-to-html-and-then-compress-the-entire-output-folder-into-a-zip-archive-programmatically.cs | Diagram, Save, diagram | Convert a diagram to html and then compress the entire output folder into a zip archive programmatically |
| convert-a-diagram-to-html-and-then-embed-the-html-into-a-sharepoint-page-via-rest-api.cs | Diagram, Save, diagram | Convert a diagram to html and then embed the html into a sharepoint page via rest api |
| convert-a-diagram-to-html-and-then-embed-the-resulting-html-into-an-email-body-using-mime-multipart-format.cs | Diagram, Save, diagram | Convert a diagram to html and then embed the resulting html into an email body using mime multipart format |
| convert-a-diagram-to-html-and-then-generate-a-pdf-snapshot-of-the-html-using-a-headless-browser-library.cs | Diagram, HTMLSaveOptions, Save | Convert a diagram to html and then generate a pdf snapshot of the html using a headless browser library |
| convert-a-diagram-to-html-and-then-generate-a-sitemap-xml-file-listing-all-generated-html-pages-for-crawling.cs | Diagram, Save, diagram | Convert a diagram to html and then generate a sitemap xml file listing all generated html pages for crawling |
| convert-a-diagram-to-html-and-then-programmatically-replace-placeholder-urls-with-cdn-links-using-string-manipulation.cs | Diagram, Save, diagram | Convert a diagram to html and then programmatically replace placeholder urls with cdn links using string manipulation |
| convert-a-diagram-to-html-and-then-validate-the-resulting-markup-against-an-html5-schema.cs | Diagram, Save, diagram | Convert a diagram to html and then validate the resulting markup against an html5 schema |
| convert-a-visio-diagram-to-html-and-embed-svg-representations-of-shapes-instead-of-raster-images.cs | Diagram, HTMLSaveOptions, Pages | Convert a visio diagram to html and embed svg representations of shapes instead of raster images |
| convert-a-visio-diagram-to-html-while-compressing-embedded-images-using-a-jpeg-encoder.cs | Diagram, HTMLSaveOptions, Save | Convert a visio diagram to html while compressing embedded images using a jpeg encoder |
| convert-a-visio-diagram-to-html-while-preserving-original-page-layout-by-setting-appropriate-htmlsaveoptions-flags.cs | Diagram, HTMLSaveOptions, Save | Convert a visio diagram to html while preserving original page layout by setting appropriate htmlsaveoptions flags |
| convert-diagrams-in-parallel-threads-each-with-its-own-istreamprovider-to-improve-batch-processing-throughput.cs | Diagram, HTMLSaveOptions, Save | Convert diagrams in parallel threads each with its own istreamprovider to improve batch processing throughput |
| create-a-batch-process-converting-multiple-visio-files-to-html-using-a-shared-istreamprovider-instance.cs | Diagram, HTMLSaveOptions, Save | Create a batch process converting multiple visio files to html using a shared istreamprovider instance |
| create-a-batch-processing-loop-that-loads-multiple-visio-files-and-tracks-progress-for-each-conversion.cs | Diagram, Save, diagram | Create a batch processing loop that loads multiple visio files and tracks progress for each conversion |
| create-a-console-app-that-accepts-a-directory-path-and-converts-all-visio-files-to-html-using-streams.cs | Diagram, Save, diagram | Create a console app that accepts a directory path and converts all visio files to html using streams |
| create-a-diagnostic-report-listing-all-resources-created-by-istreamprovider-during-a-conversion-session.cs | Diagram, HTMLSaveOptions, Save | Create a diagnostic report listing all resources created by istreamprovider during a conversion session |
| create-a-powershell-script-that-invokes-a-net-assembly-to-perform-html-conversion-with-a-custom-stream-provider.cs | Diagram, HTMLSaveOptions, Save | Create a powershell script that invokes a net assembly to perform html conversion with a custom stream provider |
| create-a-unit-test-verifying-onpagesaving-is-called-for-each-page-in-a-multi-page-diagram.cs | Diagram, Page, Pages | Create a unit test verifying onpagesaving is called for each page in a multi page diagram |
| create-a-wpf-application-that-visualizes-conversion-progress-using-animated-progress-circles-per-page.cs | Diagram, ImageSaveOptions, Pages | Create a wpf application that visualizes conversion progress using animated progress circles per page |
| create-an-event-driven-architecture-where-onpagesaved-triggers-downstream-processing-of-saved-page-files.cs | Diagram, PdfSaveOptions, Save | Create an event driven architecture where onpagesaved triggers downstream processing of saved page files |
| customize-htmlsaveoptions-to-generate-a-single-html-file-with-base64-encoded-resources-embedded.cs | Diagram, HTMLSaveOptions, Save | Customize htmlsaveoptions to generate a single html file with base64 encoded resources embedded |
| develop-a-console-application-that-accepts-input-and-output-paths-and-displays-real-time-conversion-progress.cs | Diagram, Save, diagram | Develop a console application that accepts input and output paths and displays real time conversion progress |
| develop-a-powershell-script-that-invokes-the-net-conversion-library-and-outputs-progress-messages-to-the-console.cs | Diagram, PdfSaveOptions, Save | Develop a powershell script that invokes the net conversion library and outputs progress messages to the console |
| dispose-of-all-streams-returned-by-istreamprovider-correctly-to-prevent-memory-leaks-during-batch-conversion.cs | Diagram, HTMLSaveOptions, Save | Dispose of all streams returned by istreamprovider correctly to prevent memory leaks during batch conversion |
| dispose-the-diagram-object-after-conversion-completes-to-promptly-release-unmanaged-resources.cs | Diagram, Save, diagram | Dispose the diagram object after conversion completes to promptly release unmanaged resources |
| expose-conversion-progress-through-a-rest-api-endpoint-by-invoking-the-callback-and-returning-json-status.cs | Diagram, PdfSaveOptions, Save | Expose conversion progress through a rest api endpoint by invoking the callback and returning json status |
| extend-the-callback-to-capture-timestamps-for-each-page-save-and-calculate-average-processing-time.cs | Diagram, PdfSaveOptions, Save | Extend the callback to capture timestamps for each page save and calculate average processing time |
| extract-all-shape-ids-from-a-diagram-before-conversion-and-write-them-to-a-json-file.cs | Diagram, Pages, Shapes | Extract all shape ids from a diagram before conversion and write them to a json file |
| generate-html-from-a-diagram-and-capture-warning-messages-using-the-diagram-get-warnings-collection.cs | Diagram, HTMLSaveOptions, Save | Generate html from a diagram and capture warning messages using the diagram get warnings collection |
| generate-html-output-then-extract-all-hyperlink-urls-from-the-generated-markup-for-analysis.cs | Diagram, Save, diagram | Generate html output then extract all hyperlink urls from the generated markup for analysis |
| handle-exceptions-during-diagram-save-by-wrapping-the-call-in-try-catch-and-logging-errors.cs | Diagram, Save, diagram | Handle exceptions during diagram save by wrapping the call in try catch and logging errors |
| implement-a-cancellation-token-in-the-callback-to-abort-conversion-when-the-user-requests-stop.cs | Diagram, PdfSaveOptions, Save | Implement a cancellation token in the callback to abort conversion when the user requests stop |
| implement-a-custom-class-inheriting-ipagesavingcallback-to-receive-page-level-conversion-notifications.cs | Diagram, PdfSaveOptions, Save | Implement a custom class inheriting ipagesavingcallback to receive page level conversion notifications |
| implement-a-custom-ipagesavingcallback-that-throttles-conversion-speed-to-limit-cpu-usage-on-low-end-devices.cs | Diagram, PdfSaveOptions, Save | Implement a custom ipagesavingcallback that throttles conversion speed to limit cpu usage on low end devices |
| implement-a-custom-istreamprovider-that-caches-streams-in-memory-to-avoid-repeated-disk-writes-for-identical-resources.cs | Diagram, HTMLSaveOptions, Save | Implement a custom istreamprovider that caches streams in memory to avoid repeated disk writes for identical resources |
| implement-a-custom-istreamprovider-that-returns-a-read-only-stream-for-existing-resources-to-avoid-duplication.cs | Diagram, HTMLSaveOptions, Save | Implement a custom istreamprovider that returns a read only stream for existing resources to avoid duplication |
| implement-a-custom-istreamprovider-that-streams-resources-directly-to-an-http-response-for-web-api-delivery.cs | Diagram, HTMLSaveOptions, Save | Implement a custom istreamprovider that streams resources directly to an http response for web api delivery |
| implement-a-custom-istreamprovider-that-writes-image-resources-to-a-memory-stream-for-later-processing.cs | Diagram, HTMLSaveOptions, Save | Implement a custom istreamprovider that writes image resources to a memory stream for later processing |
| implement-a-logging-mechanism-inside-istreamprovider-getstream-to-record-each-resource-creation-event.cs | Diagram, HTMLSaveOptions, Save | Implement a logging mechanism inside istreamprovider getstream to record each resource creation event |
| implement-a-progress-reporter-updating-a-console-progress-bar-each-time-istreamprovider-getstream-is-called.cs | Diagram, HTMLSaveOptions, Save | Implement a progress reporter updating a console progress bar each time istreamprovider getstream is called |
| implement-a-retry-mechanism-for-transient-i-o-errors-when-writing-resource-streams-in-istreamprovider.cs | Diagram, HTMLSaveOptions, Save | Implement a retry mechanism for transient i o errors when writing resource streams in istreamprovider |
| implement-a-retry-mechanism-that-re-attempts-saving-a-page-if-onpagesaved-reports-failure.cs | Diagram, PdfSaveOptions, Save | Implement a retry mechanism that re attempts saving a page if onpagesaved reports failure |
| implement-a-unit-test-verifying-istreamprovider-receives-correct-resource-type-identifiers-for-images-and-shapes.cs | AddShape, Diagram, HTMLSaveOptions | Implement a unit test verifying istreamprovider receives correct resource type identifiers for images and shapes |
| implement-a-unit-test-verifying-the-custom-istreamprovider-receives-correct-resource-names-during-conversion.cs | AddShape, Diagram, HTMLSaveOptions | Implement a unit test verifying the custom istreamprovider receives correct resource names during conversion |
| implement-error-handling-for-missing-resource-streams-when-istreamprovider-returns-null-for-a-requested-name.cs | Diagram, HTMLSaveOptions, Save | Implement error handling for missing resource streams when istreamprovider returns null for a requested name |
| implement-istreamprovider-getstream-to-route-shape-resources-to-separate-subfolders-based-on-shape-type.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider getstream to route shape resources to separate subfolders based on shape type |
| implement-istreamprovider-to-log-the-size-of-each-resource-stream-after-it-is-closed-for-auditing-purposes.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider to log the size of each resource stream after it is closed for auditing purposes |
| implement-istreamprovider-to-store-resources-in-a-compressed-gzip-stream-before-writing-to-disk.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider to store resources in a compressed gzip stream before writing to disk |
| implement-istreamprovider-to-store-resources-in-azure-blob-storage-and-reference-them-via-public-urls.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider to store resources in azure blob storage and reference them via public urls |
| implement-istreamprovider-to-store-shape-resources-in-a-database-blob-field-instead-of-file-system.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider to store shape resources in a database blob field instead of file system |
| implement-istreamprovider-to-write-resource-streams-to-a-temporary-folder-that-is-automatically-cleaned-up-after-convers.cs | Diagram, HTMLSaveOptions, Save | Implement istreamprovider to write resource streams to a temporary folder that is automatically cleaned up after convers |
| implement-localization-in-progress-messages-to-support-multiple-languages-during-conversion-ui-display.cs | Diagram, ImageSaveOptions, PdfSaveOptions | Implement localization in progress messages to support multiple languages during conversion ui display |
| integrate-page-progress-messages-into-a-windows-forms-progress-bar-to-reflect-conversion-status.cs | Diagram, ImageSaveOptions, Pages | Integrate page progress messages into a windows forms progress bar to reflect conversion status |
| load-a-visio-diagram-from-a-file-path-and-initialize-a-diagram-object.cs | Diagram | Load a visio diagram from a file path and initialize a diagram object |
| load-a-visio-diagram-from-a-file-path-and-validate-its-structure-before-conversion.cs | Diagram, Pages, Shapes | Load a visio diagram from a file path and validate its structure before conversion |
| log-page-index-and-total-page-count-to-a-database-table-for-audit-trail-purposes.cs | Diagram, Pages, diagram | Log page index and total page count to a database table for audit trail purposes |
| measure-performance-of-html-conversion-with-and-without-a-custom-istreamprovider-to-compare-speed.cs | Diagram, HTMLSaveOptions, Save | Measure performance of html conversion with and without a custom istreamprovider to compare speed |
| measure-total-conversion-time-by-recording-timestamps-before-and-after-diagram-save-and-logging-duration.cs | Diagram, Save, diagram | Measure total conversion time by recording timestamps before and after diagram save and logging duration |
| mock-ipagesavingcallback-in-integration-tests-to-simulate-progress-events-without-performing-actual-file-saves.cs | Diagram, PdfSaveOptions, Save | Mock ipagesavingcallback in integration tests to simulate progress events without performing actual file saves |
| override-onpagesaved-to-log-completion-of-each-page-save-and-total-pages-processed.cs | Diagram, PdfSaveOptions, Save | Override onpagesaved to log completion of each page save and total pages processed |
| override-onpagesaving-to-log-the-start-of-each-page-save-operation-with-its-index.cs | Diagram, PdfSaveOptions, Save | Override onpagesaving to log the start of each page save operation with its index |
| profile-memory-usage-during-large-diagram-conversion-to-ensure-callback-implementation-does-not-cause-leaks.cs | Diagram, PdfSaveOptions, Save | Profile memory usage during large diagram conversion to ensure callback implementation does not cause leaks |
| save-html-conversion-output-to-a-network-share-by-providing-a-stream-that-writes-to-a-unc-path.cs | Diagram, Save, diagram | Save html conversion output to a network share by providing a stream that writes to a unc path |
| save-the-loaded-diagram-to-pdf-format-while-receiving-progress-callbacks-for-each-page.cs | Diagram, PdfSaveOptions, Save | Save the loaded diagram to pdf format while receiving progress callbacks for each page |
| serialize-progress-callback-data-to-json-and-write-to-a-cloud-storage-bucket-for-remote-monitoring.cs | Diagram, PdfSaveOptions, Save | Serialize progress callback data to json and write to a cloud storage bucket for remote monitoring |
| use-a-custom-istreamprovider-that-prefixes-each-resource-file-name-with-a-timestamp-to-ensure-uniqueness.cs | Diagram, HTMLSaveOptions, Save | Use a custom istreamprovider that prefixes each resource file name with a timestamp to ensure uniqueness |
| use-a-custom-istreamprovider-that-writes-resource-streams-to-a-networked-file-system-with-retry-logic.cs | Diagram, HTMLSaveOptions, Save | Use a custom istreamprovider that writes resource streams to a networked file system with retry logic |
| use-a-custom-istreamprovider-to-encrypt-image-streams-before-writing-them-to-disk.cs | Diagram, HTMLSaveOptions, Save | Use a custom istreamprovider to encrypt image streams before writing them to disk |
| use-a-custom-istreamprovider-to-generate-thumbnail-images-for-each-page-and-embed-them-in-the-html-index.cs | Diagram, HTMLSaveOptions, ImageSaveOptions | Use a custom istreamprovider to generate thumbnail images for each page and embed them in the html index |
| use-dependency-injection-to-provide-the-ipagesavingcallback-implementation-to-the-conversion-service.cs | Diagram, PdfSaveOptions, Save | Use dependency injection to provide the ipagesavingcallback implementation to the conversion service |
| use-diagram-load-with-a-stream-containing-a-visio-file-encrypted-with-a-password-and-then-convert.cs | Diagram, PdfSaveOptions, Save | Use diagram load with a stream containing a visio file encrypted with a password and then convert |
| use-diagram-loadoptions-to-specify-password-for-encrypted-visio-files-before-tracking-conversion-progress.cs | Diagram, PdfSaveOptions, Save | Use diagram loadoptions to specify password for encrypted visio files before tracking conversion progress |
| use-diagram-save-with-a-filestream-and-htmlsaveoptions-to-write-html-directly-to-a-pre-created-file.cs | AddShape, Diagram, HTMLSaveOptions | Use diagram save with a filestream and htmlsaveoptions to write html directly to a pre created file |
| use-diagram-save-with-a-memorystream-and-htmlsaveoptions-to-generate-html-without-touching-the-file-system.cs | Diagram, HTMLSaveOptions, Save | Use diagram save with a memorystream and htmlsaveoptions to generate html without touching the file system |
| use-htmlsaveoptions-to-control-whether-shape-tooltips-are-included-in-the-generated-html-output.cs | Diagram, HTMLSaveOptions, Save | Use htmlsaveoptions to control whether shape tooltips are included in the generated html output |
| use-htmlsaveoptions-to-disable-generation-of-external-css-files-and-produce-inline-style-definitions.cs | Diagram, HTMLSaveOptions, Save | Use htmlsaveoptions to disable generation of external css files and produce inline style definitions |
| use-htmlsaveoptions-to-enable-or-disable-inclusion-of-comments-from-the-original-visio-file-in-html-output.cs | Diagram, HTMLSaveOptions, Save | Use htmlsaveoptions to enable or disable inclusion of comments from the original visio file in html output |
| use-htmlsaveoptions-to-set-a-custom-base-url-for-all-linked-resources-in-the-html-file.cs | Diagram, HTMLSaveOptions, Save | Use htmlsaveoptions to set a custom base url for all linked resources in the html file |
| use-parallel-foreach-to-convert-visio-diagrams-concurrently-while-ensuring-thread-safe-progress-logging.cs | Diagram, Save, diagram | Use parallel foreach to convert visio diagrams concurrently while ensuring thread safe progress logging |
| validate-all-external-resource-references-in-generated-html-point-to-existing-files-after-conversion.cs | Diagram, Save, diagram | Validate all external resource references in generated html point to existing files after conversion |
| validate-no-duplicate-resource-names-are-produced-when-converting-diagrams-containing-identical-shapes.cs | Diagram, Pages, Save | Validate no duplicate resource names are produced when converting diagrams containing identical shapes |
| validate-that-total-page-count-reported-in-callbacks-matches-diagram-pages-collection-size-after-loading.cs | Diagram, Pages, PdfSaveOptions | Validate that total page count reported in callbacks matches diagram pages collection size after loading |
| validate-the-number-of-generated-image-streams-matches-the-number-of-pages-in-the-source-diagram.cs | Diagram, ImageSaveOptions, Pages | Validate the number of generated image streams matches the number of pages in the source diagram |
| write-page-start-and-end-notifications-to-a-text-file-using-a-custom-logger-implementation.cs | Diagram, Pages, Save | Write page start and end notifications to a text file using a custom logger implementation |
Command Reference
# Build the warmup project
cd compiler/CSharpRunner/_warmup
dotnet build
# Run a specific example (copy .cs content to Program.cs first)
dotnet run
# Build with verbose output
dotnet build --verbosity detailed.csproj Template
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>MSB3277</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aspose.Diagram">
<HintPath>..\..\libs\Aspose.Diagram.dll</HintPath>
</Reference>
</ItemGroup>
</Project>Testing Guide
Build Verification
dotnet build # Must exit with rc=0, zero compiler errorsRun Verification
dotnet run # rc=0 = pass, rc!=0 with unhandled exception = failExpected Output Patterns
| Pattern | Meaning |
rc=0 | ✅ Pass — example compiled and ran successfully |
rc=1 compiler errors | ❌ Fail — CS error codes indicate API misuse |
rc!=0 runtime | ⚠️ Check — may be acceptable (missing input file) |
| TIMEOUT | ✅ Pass — Console.ReadLine() treated as successful completion |
Common CS Error Codes
| Code | Meaning | Fix |
| CS1061 | Member does not exist | Check correct property/method name |
| CS0200 | Property is read-only | Access via .Value instead of assignment |
| CS0029 | Cannot convert type | Use correct enum type (BOOL not bool) |
| CS0117 | Name does not exist in type | Check enum member name casing |
| CS0234 | Namespace not found | Add correct using directive |
Pipeline
| Attempt | Strategy | Trigger |
| 1 | MCP direct retrieval + code assembly | Always |
| 2 | MCP retrieval with injected rules | Attempt 1 fails |
| 3 | LLM repair with compiler errors + rules | Attempt 2 fails |
Only examples that pass both dotnet build and dotnet run are committed.
General Tips
- See root agents.md for repository-wide boundaries, anti-patterns, domain knowledge, and testing guidelines
- Always check
rules/rules.jsonfor the latest API correction rules - SaveFileFormat enum must always be PascalCase:
Vsdx,Pdf,Png,Jpeg,Svg,Html— never ALL_CAPS - Diagram class does NOT implement IDisposable — never use
using (Diagram ...)
Key API Surface
AddShapeDiagramHTMLSaveOptionsImageSaveOptionsPagePagesPdfSaveOptionsSVGSaveOptionsSaveShapesdiagrampage
Real-World Use Cases
Common scenarios where Aspose.Diagram for .NET diagram conversions capabilities are applied in production applications:
- Converting Visio diagrams to PDF for distribution and printing
- Exporting diagrams to PNG/SVG for embedding in web applications
- Batch-converting legacy VSD files to modern VSDX format
Developer Q&A
Frequently asked questions about Diagram Conversions in Aspose.Diagram for .NET:
Q: How do I get started with Diagram Conversions in Aspose.Diagram for .NET?
A: Add a reference to Aspose.Diagram.dll (v26.9.0), include using Aspose.Diagram; and using Aspose.Diagram.Saving;, then use Diagram diagram = new Diagram("input.vsdx"); to load a file. All examples in this category target net8.0.
Q: Why do I get CS1674 when using using (Diagram diagram = ...)?
A: Diagram does not implement IDisposable in Aspose.Diagram for .NET. Remove the using statement and declare the variable normally: Diagram diagram = new Diagram("input.vsdx");
Q: Why does my code fail with CS0117 on SaveFileFormat.VSDX?
A: SaveFileFormat enum members use PascalCase in Aspose.Diagram for .NET. Use SaveFileFormat.Vsdx (not VSDX). The same applies to all formats: SaveFileFormat.Pdf, SaveFileFormat.Png, SaveFileFormat.Svg.
Q: Why do I get CS0029 when assigning true to a BOOL property?
A: Aspose.Diagram uses its own BOOL enumeration type, not C# bool. Use BOOL.True and BOOL.False instead of plain true/false for all Aspose.Diagram BOOL properties.
Q: How do I convert a Visio diagram to PDF?
A: Use PdfSaveOptions opts = new PdfSaveOptions(); diagram.Save("output.pdf", opts); or the shorthand diagram.Save("output.pdf", SaveFileFormat.Pdf);
Related Categories
- Convert Visio Document — format conversion operations
- Working With Images — image embedding and extraction
- Page Setup Features — page size, margins, and orientation
Category Statistics
- Total examples: 96
- Failed: 0
- Pass rate: 100.0%
Failed Tasks
All tasks passed ✅
Updated: 2026-09-24 | Examples: 96 | Pass Rate: 100.0% | ↑ Root agents.md | Aspose.Diagram for .NET
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

