[Public] Troubleshooting FailFast Exceptions with IronPDF in ReadyToRun Deployments
When deploying .NET applications using ReadyToRun (R2R) compilation, some developers encounter a FailFast
exception during runtime — especially when working with libraries like IronPDF.
The application requested process termination through System.Environment.FailFast. Message: Stack: at System.Environment.FailFast(System.String) at <Module>..cctor() at Program.<Main>$(System.String[])
What Is the Problem?
In some ReadyToRun-compiled deployments, IronPDF may trigger a System.Runtime.FailFast
error. This crash typically occurs at startup and prevents your application from running.
Why?
ReadyToRun (R2R) compiles your .NET assemblies into native code ahead of time to improve startup performance. However, certain libraries like IronPDF rely on runtime dynamic behavior, and R2R compilation can break these assumptions.
Recommended Solutions
1. Exclude IronPDF from ReadyToRun Compilation
If you're compiling your entire application with ReadyToRun, consider excluding IronPDF to avoid runtime issues.
How to Exclude:
Add the following property group to your .csproj
file:
<ItemGroup>
<PublishReadyToRunExclude>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</PublishReadyToRunExclude>
</ItemGroup>
You’ll still get ReadyToRun benefits for the rest of your app while keeping IronPDF safe from R2R-related issues.
2. Rollback to IronPDF v2023.12.6
This version works more stable in Ready2Run environment
Steps:
-
Open Visual Studio.
-
Uninstall the current IronPDF NuGet package.
-
Reinstall version
2023.12.6
from NuGet:Install-Package IronPdf -Version 2023.12.6
-
Rebuild and redeploy your application.
🔗 Further Reading
For full guidance on using IronPDF with ReadyToRun, visit our official documentation:
👉 Troubleshooting ReadyToRun with IronPDF