IronPDF on Linux (WSL) - Fixing Win32Exception When License Key Is Not Set
Edge cases of getting Win32Exception running unlicensed app with UpdatedChrome
Symptom
You try to generate a PDF using IronPDF on Linux (Ubuntu, WSL, or Docker), and instead of a licensing error, you get this:
System.ComponentModel.Win32Exception:
An error occurred trying to start process 'xdg-open' with working directory
'/path/to/your/project/bin/Debug/net7.0'. No such file or directory
This can be confusing—especially if everything looks correctly configured.
Possible Cause
This typically happens when:
-
You're running under WSL or headless Linux environments
-
You haven't set your IronPDF license key
-
xdg-openis missing
Solution
1. Set the IronPDF license key
Always have the license key and set it before rendering PDFs:
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
Even trial key will eliminate this issue.
2. Install xdg-utils
If you're working in an environment where licensing might not be set (e.g., evaluation, sandbox, CI), install xdg-utils to avoid errors like the one above:
sudo apt update
sudo apt install xdg-utils
This enables the fallback mechanism to show licensing-related information without crashing.
Best Practices
-
Always license IronPDF in all environments (dev, CI, prod)
-
Use logging to track render failures early
-
Automate dependency installation (
xdg-utils) in your Docker or CI setup if needed