Use ReadyToRun or Ahead-Of-Time (AOT) Compilation
.NET ReadyToRun (R2R) is a form of ahead-of-time (AOT) compilation.
Enabling ReadyToRun compilation during deployment might violate tampering protection and result in exceptions such as the following:
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPdf, Version=2024.2.0.2, Culture=neutral, PublicKeyToken=94e1c31412563c75 assembly is not authentic. Please try to reinstall the nuget package
at IronPdf.PdfDocument.uswvws(Boolean vhfwdf)
at IronPdf.PdfDocument.get_BinaryData()
at IronPdf.PdfDocument.SaveAs(String FileName, Boolean SaveAsRevision)
at Program.<Main>(String[] args) in C:\csharppro\aottest\aottest\Program.cs:line 5
Reason
According to Microsoft documentation, the SDK will precompile the assemblies that are distributed with the application. For self-contained applications, this set of assemblies will include the framework. It's important to note that C++/CLI binaries are not eligible for ReadyToRun compilation.
Solution
To exclude specific assemblies from ReadyToRun processing, use the <PublishReadyToRunExclude> list in your project file. For example, to exclude the IronPdf.dll assembly:
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
This XML snippet should be added to your project file (.csproj) to prevent the specified assemblies from being precompiled with ReadyToRun, thus avoiding potential licensing or tampering issues.
System.Environment.FailFast on First IronPDF Call
In some Windows deployments, IronPDF crashes the process immediately on the first IronPDF call with no application-level log output. Windows Event Log records an entry similar to:
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[])
This is a different failure from the licensing exception above. The crash occurs during static initialization before normal logging is available, so no IronPDF log lines appear before the process terminates.
This pattern has been confirmed in ASP.NET Core applications hosted in IIS on Windows Server with PublishReadyToRun enabled. It has been reproduced on:
- IronPDF 2026.4.1
- .NET 10
- IIS (
w3wp.exe) on Windows Server 2025 Datacenter - AWS EC2
win-x64publish target
Solution
Keep <PublishReadyToRun>true</PublishReadyToRun> for the application and exclude only IronPdf.dll:
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
A full .csproj example:
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IronPdf" Version="2026.4.1" />
</ItemGroup>
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IronPdf" Version="2026.4.1" />
</ItemGroup>
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
After updating the .csproj, republish the application, redeploy, and restart the IIS site or recycle the Application Pool.

