agentleFS
aspose-diagramaspose-diagram/agentic-net-examples/diagram-conversions/agents.md

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…

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
  1. Very specific:

    Use explicit types — Diagram diagram = new Diagram(...) not var diagram = ...

    line 38
  2. Very specific:

    Use SaveFileFormat enum in PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf

    line 40
  3. Very specific:

    Use BOOL.True / BOOL.False for Aspose BOOL properties — never plain true/false

    line 41
  4. Very specific:

    Use var for any variable declaration

    line 53
  5. Very specific:

    Use using (Diagram diagram = ...) — Diagram does not implement IDisposable

    line 54
  6. Very specific:

    Use SaveFileFormat.VSDX or other ALL_CAPS enum values

    line 55
  7. Very specific:

    Use System.Windows.Forms — not available in net8.0 console project

    line 56
  8. Very specific:

    Use NUnit Assert — not available, use Console.WriteLine and manual checks

    line 57
  9. Distinctive:

    Use PowerShell syntax inside C# files

    line 58
  10. Very specific:

    Only examples that pass both dotnet build and dotnet run are committed.

    line 289
  11. Very specific:

    Always check rules/rules.json for the latest API correction rules

    line 294

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

Diagram Conversions

AI-generated, compiler-validated C# examples for the Aspose.Diagram for .NET API — Diagram Conversions category.

Statistics

MetricValue
Examples96
Pass Rate100.0%
Aspose.Diagram Version26.9.0
Target Frameworknet8.0
Last Updated2026-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(...) not var diagram = ...
  • Include using Aspose.Diagram; and using Aspose.Diagram.Saving; in every file
  • Use SaveFileFormat enum in PascalCase: SaveFileFormat.Vsdx, SaveFileFormat.Pdf
  • Use BOOL.True / BOOL.False for Aspose BOOL properties — never plain true/false
  • Wrap entry point in static void Main() inside class Program
  • Handle FileNotFoundException with 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 var for any variable declaration
  • Use using (Diagram diagram = ...) — Diagram does not implement IDisposable
  • Use SaveFileFormat.VSDX or other ALL_CAPS enum values
  • Use System.Windows.Forms — not available in net8.0 console project
  • Use NUnit Assert — not available, use Console.WriteLine and manual checks
  • Use PowerShell syntax inside C# files

Required Namespaces

NamespaceFilesPurpose
Aspose.Diagram96Core diagram API
System96Console, Math, DateTime, Exception
System.IO74File, Stream, Path, Directory operations
Aspose.Diagram.Saving73Save options (PDF, PNG, HTML, SVG, XPS)
System.Collections.Generic20List, Dictionary, HashSet
System.Threading5Supporting utilities
System.Text.Json4JSON serialization
System.Threading.Tasks4Supporting utilities
System.Text.RegularExpressions3Supporting utilities
Aspose.Diagram.Properties2Supporting utilities
System.IO.Compression2Supporting utilities
System.Xml2Supporting utilities
System.Data2Supporting utilities
System.Net.Http1Supporting utilities
System.Net.Http.Headers1Supporting utilities
System.Text1StringBuilder
System.Net.Mail1Supporting utilities
System.Net.Mime1Supporting utilities
System.Xml.Schema1Supporting utilities
Aspose.Drawing.Imaging1Supporting utilities
System.Data.Common1Supporting utilities
System.Data.SqlClient1Supporting utilities
System.Diagnostics1Supporting utilities
System.Security.Cryptography1Supporting utilities
System.Collections.Concurrent1Supporting 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

FileKey APIsTask
add-configuration-to-enable-or-disable-progress-logging-via-appsettings-json-without-code-changes.csDiagram, Save, diagramAdd 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.csDiagram, PdfSaveOptions, SaveAdd 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.csDiagram, HTMLSaveOptions, PagesApply 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.csDiagram, HTMLSaveOptions, SaveApply 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.csDiagram, PdfSaveOptions, SaveAssign the custom ipagesavingcallback instance to diagramsavingoptions before invoking save
combine-page-progress-callbacks-with-image-extraction-to-save-each-page-as-separate-png-files.csDiagram, ImageSaveOptions, PagesCombine 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.csDiagram, Save, diagramConfigure diagramsavingoptions to embed metadata indicating conversion timestamp and source file name
configure-htmlsaveoptions-to-embed-css-styles-directly-within-the-generated-html-output.csDiagram, HTMLSaveOptions, SaveConfigure 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.csDiagram, HTMLSaveOptions, PagesConfigure 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.csDiagram, HTMLSaveOptions, SaveConfigure 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.csDiagram, HTMLSaveOptions, SaveConfigure 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.csDiagram, HTMLSaveOptions, SaveConfigure 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.csDiagram, HTMLSaveOptions, SaveConfigure 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.csDiagram, Save, diagramConvert 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.csDiagram, Save, diagramConvert 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.csDiagram, Save, diagramConvert 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.csDiagram, HTMLSaveOptions, SaveConvert 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.csDiagram, Save, diagramConvert 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.csDiagram, Save, diagramConvert 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.csDiagram, Save, diagramConvert 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.csDiagram, HTMLSaveOptions, PagesConvert 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.csDiagram, HTMLSaveOptions, SaveConvert 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.csDiagram, HTMLSaveOptions, SaveConvert 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.csDiagram, HTMLSaveOptions, SaveConvert 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.csDiagram, HTMLSaveOptions, SaveCreate 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.csDiagram, Save, diagramCreate 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.csDiagram, Save, diagramCreate 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.csDiagram, HTMLSaveOptions, SaveCreate 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.csDiagram, HTMLSaveOptions, SaveCreate 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.csDiagram, Page, PagesCreate 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.csDiagram, ImageSaveOptions, PagesCreate 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.csDiagram, PdfSaveOptions, SaveCreate 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.csDiagram, HTMLSaveOptions, SaveCustomize 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.csDiagram, Save, diagramDevelop 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.csDiagram, PdfSaveOptions, SaveDevelop 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.csDiagram, HTMLSaveOptions, SaveDispose 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.csDiagram, Save, diagramDispose 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.csDiagram, PdfSaveOptions, SaveExpose 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.csDiagram, PdfSaveOptions, SaveExtend 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.csDiagram, Pages, ShapesExtract 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.csDiagram, HTMLSaveOptions, SaveGenerate 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.csDiagram, Save, diagramGenerate 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.csDiagram, Save, diagramHandle 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.csDiagram, PdfSaveOptions, SaveImplement 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.csDiagram, PdfSaveOptions, SaveImplement 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.csDiagram, PdfSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, PdfSaveOptions, SaveImplement 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.csAddShape, Diagram, HTMLSaveOptionsImplement 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.csAddShape, Diagram, HTMLSaveOptionsImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, HTMLSaveOptions, SaveImplement 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.csDiagram, ImageSaveOptions, PdfSaveOptionsImplement 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.csDiagram, ImageSaveOptions, PagesIntegrate 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.csDiagramLoad 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.csDiagram, Pages, ShapesLoad 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.csDiagram, Pages, diagramLog 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.csDiagram, HTMLSaveOptions, SaveMeasure 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.csDiagram, Save, diagramMeasure 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.csDiagram, PdfSaveOptions, SaveMock 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.csDiagram, PdfSaveOptions, SaveOverride 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.csDiagram, PdfSaveOptions, SaveOverride 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.csDiagram, PdfSaveOptions, SaveProfile 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.csDiagram, Save, diagramSave 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.csDiagram, PdfSaveOptions, SaveSave 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.csDiagram, PdfSaveOptions, SaveSerialize 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, ImageSaveOptionsUse 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.csDiagram, PdfSaveOptions, SaveUse 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.csDiagram, PdfSaveOptions, SaveUse 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.csDiagram, PdfSaveOptions, SaveUse 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.csAddShape, Diagram, HTMLSaveOptionsUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, HTMLSaveOptions, SaveUse 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.csDiagram, Save, diagramUse 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.csDiagram, Save, diagramValidate 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.csDiagram, Pages, SaveValidate 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.csDiagram, Pages, PdfSaveOptionsValidate 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.csDiagram, ImageSaveOptions, PagesValidate 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.csDiagram, Pages, SaveWrite 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 errors

Run Verification

dotnet run    # rc=0 = pass, rc!=0 with unhandled exception = fail

Expected Output Patterns

PatternMeaning
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

CodeMeaningFix
CS1061Member does not existCheck correct property/method name
CS0200Property is read-onlyAccess via .Value instead of assignment
CS0029Cannot convert typeUse correct enum type (BOOL not bool)
CS0117Name does not exist in typeCheck enum member name casing
CS0234Namespace not foundAdd correct using directive

Pipeline

AttemptStrategyTrigger
1MCP direct retrieval + code assemblyAlways
2MCP retrieval with injected rulesAttempt 1 fails
3LLM repair with compiler errors + rulesAttempt 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.json for 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

  • AddShape
  • Diagram
  • HTMLSaveOptions
  • ImageSaveOptions
  • Page
  • Pages
  • PdfSaveOptions
  • SVGSaveOptions
  • Save
  • Shapes
  • diagram
  • page

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

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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.