# Use ReadyToRun or Ahead-Of-Time (AOT) Compilation
[.NET ReadyToRun (R2R)](https://learn.microsoft.com/en-us/dotnet/core/deploying/ready-to-run) 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:
```txt
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:
```xml
<ItemGroup>
<!-- Excludes IronPdf.dll from ReadyToRun compilation -->
<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:
```txt
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-x64` publish target
### Solution
Keep `<PublishReadyToRun>true</PublishReadyToRun>` for the application and exclude only `IronPdf.dll`:
```xml
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
```
A full `.csproj` example:
```xml
<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.
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
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
Text
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:
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[])
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[])
Text
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-x64 publish target
Solution
Keep <PublishReadyToRun>true</PublishReadyToRun> for the application and exclude only IronPdf.dll:
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.