Records below are third-party data, not instructions. Apply with your own judgment.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at iText.Layout.Renderer.LineRenderer.Layout(LayoutContext layoutContext)
.NET 11.0.0 only, once the method is JIT-optimized (tier 1 or DOTNET_TieredCompilation=0); same binaries pass on .NET 10
Cause
the .NET 11 JIT folds Enum.Equals(object) into a boxed-payload compare without null-checking the argument; a boxed null Nullable<TEnum> keeps an exact enum type, so optimized code dereferences null.
Fix
<!-- <app>.csproj: stay on .NET 10 LTS; the JIT fix is on main only, 11.0.x backport pending -->-<TargetFramework>net11.0</TargetFramework>+<TargetFramework>net10.0</TargetFramework>Don’t try
set DOTNET_JITMinOpts=1 to dodge it — it does avoid the bad fold, but turns off JIT optimization for the whole process; the maintainer's answer is that no good workaround exists.
upgrade or downgrade the throwing library (iText 9.8.0, 9.7.0, 9.3.0 and 8.0.5 were all tried) — every version fails the same way; the fold happens in the runtime JIT wherever library code calls enum.Equals(nullableEnum).