Api: remove stale IsAotCompatible flag (abandoned AOT experiment emitting 115 IL2026/IL3050 warnings) #683

Closed
opened 2026-07-17 20:32:48 +00:00 by spikerj · 1 comment
Owner

Problem

SpikerSoft.Api/SpikerSoft.API.csproj sets <IsAotCompatible>true</IsAotCompatible>, a leftover from a .NET 10-preview AOT experiment (PublishAot, PublishTrimmed, TrimMode are all commented out right below it). That single flag turns on the trim/AOT analyzers, which emit 115 warnings in Api alone (66 IL2026 RequiresUnreferencedCode + 49 IL3050 RequiresDynamicCode).

These warnings are noise for this host: Api is published framework-dependent (Dockerfile: dotnet publish /p:UseAppHost=false, no PublishAot/PublishTrimmed) and runs as a normal JIT service on the Swarm. Its MVC + MediatR + EF Core Mongo + reflection-based System.Text.Json/Mongo serialization stack is fundamentally not trim/AOT-safe, so the analyzer is flagging real trim-unsafety against a publish mode Api never uses.

Fix

Remove <IsAotCompatible>true</IsAotCompatible> from the Api csproj (analyzer-only flag; produces identical IL and an identical published artifact). A comment documents why the host is intentionally not AOT/trim-targeted, so the flag is not reinnstated. This clears all 115 IL2026/IL3050 findings at the source rather than dispositioning them one by one, and stops future IL-warning accumulation.

GameServer (genuinely PublishAot=true) is untouched — its trim/AOT analyzers stay on and its warnings, if any, remain real.

Verification

  • dotnet build SpikerSoft.API.csproj -c Release: Build succeeded, 0 IL2026/IL3050 warnings (was 115).
  • dotnet build SpikerSoft.UnitTests.slnf -c Release: Build succeeded, 0 errors.
  • No runtime/behavior change: analyzer-only MSBuild property, framework-dependent publish unchanged.
## Problem `SpikerSoft.Api/SpikerSoft.API.csproj` sets `<IsAotCompatible>true</IsAotCompatible>`, a leftover from a .NET 10-preview AOT experiment (`PublishAot`, `PublishTrimmed`, `TrimMode` are all commented out right below it). That single flag turns on the trim/AOT analyzers, which emit **115 warnings** in Api alone (66 IL2026 `RequiresUnreferencedCode` + 49 IL3050 `RequiresDynamicCode`). These warnings are noise for this host: Api is published **framework-dependent** (`Dockerfile`: `dotnet publish /p:UseAppHost=false`, no `PublishAot`/`PublishTrimmed`) and runs as a normal JIT service on the Swarm. Its MVC + MediatR + EF Core Mongo + reflection-based `System.Text.Json`/Mongo serialization stack is fundamentally not trim/AOT-safe, so the analyzer is flagging real trim-unsafety against a publish mode Api never uses. ## Fix Remove `<IsAotCompatible>true</IsAotCompatible>` from the Api csproj (analyzer-only flag; produces identical IL and an identical published artifact). A comment documents why the host is intentionally not AOT/trim-targeted, so the flag is not reinnstated. This clears all 115 IL2026/IL3050 findings at the source rather than dispositioning them one by one, and stops future IL-warning accumulation. GameServer (genuinely `PublishAot=true`) is untouched — its trim/AOT analyzers stay on and its warnings, if any, remain real. ## Verification - `dotnet build SpikerSoft.API.csproj -c Release`: **Build succeeded, 0 IL2026/IL3050 warnings** (was 115). - `dotnet build SpikerSoft.UnitTests.slnf -c Release`: **Build succeeded, 0 errors**. - No runtime/behavior change: analyzer-only MSBuild property, framework-dependent publish unchanged.
Author
Owner

Resolved in spikersoft-backend PR #381 (merged to master). Removed the stale <IsAotCompatible>true> from SpikerSoft.API.csproj (leftover from the abandoned .NET 10-preview AOT trial), which cleared all 115 IL2026/IL3050 warnings at the source with zero runtime change. CI: both amd64+arm64 image builds and unit tests passed green. Closing.

Resolved in spikersoft-backend PR #381 (merged to `master`). Removed the stale `<IsAotCompatible>true>` from `SpikerSoft.API.csproj` (leftover from the abandoned .NET 10-preview AOT trial), which cleared all 115 IL2026/IL3050 warnings at the source with zero runtime change. CI: both amd64+arm64 image builds and unit tests passed green. Closing.
Sign in to join this conversation.