ShowPrintDialog Behavior in IronPrint (Post-2024.9)

ShowPrintDialog and ShowPrintDialogAsync no longer throw an exception when called on an unsupported target framework. As of version 2024.9, they log a warning and fall back to PrintAsync() instead.

Before this change, calling either method without a compatible TargetFramework raised the following error:

System.AggregateException: 'One or more errors occurred.
(Please try Print/PrintAsync since ShowPrintDialog/ShowPrintDialogAsync in NET Core or NET Standard,
it required UI component so please set more specific OS TargetFrameworks
e.g. net462; net472; net7.0-windows; net7.0-macos; net7.0-maccatalyst; net7.0-android)'

The dialog methods need a UI component, which is unavailable under plain .NET Core or .NET Standard targets. Earlier builds treated this as a hard failure and threw. The exception was disruptive at runtime, so the behavior was changed deliberately in 2024.9.

Solution

The fallback is automatic, but you can control which path runs by choosing the right target.

1. Rely on the Automatic Fallback

On an unsupported framework, the call now logs a warning and routes to PrintAsync() rather than throwing. Existing code keeps running without a crash, though no print dialog appears.

WarningThe fallback prints without a dialog. Users see no print prompt on unsupported targets, so do not depend on the dialog being shown unless you target a UI framework.

2. Target a UI-Capable Framework for the Dialog

To get the actual print dialog, build against an OS-specific target that includes UI support:

<TargetFrameworks>net462;net472;net7.0-windows;net7.0-macos;net7.0-maccatalyst;net7.0-android</TargetFrameworks>
<TargetFrameworks>net462;net472;net7.0-windows;net7.0-macos;net7.0-maccatalyst;net7.0-android</TargetFrameworks>
XML

With one of these frameworks in place, ShowPrintDialog and ShowPrintDialogAsync display the dialog as expected.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 43,228 | Version: 2026.7 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronPrint
run a sample watch your document hit the printer.