iOS project error: IL Trimmer has encountered an unexpected error.

Kim Strasser 1,671 Reputation points
2025-10-27T21:31:33.97+00:00

I get two errors when I debug an empty iOS project on my iPad Air in Visual Studio Community 2026 Insiders 11123.170.

IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink The file "obj\Debug\net9.0-ios\ios-arm64\linked\Link.semaphore" cannot be created. Could not find a part of the path 'C:\Users\Kim Strasser\source\repos\IOSTest\IOSTest\obj\Debug\net9.0-ios\ios-arm64\linked\Link.semaphore'.

I created the iOS project some time ago in Visual Studio Community 2022 and I can debug the iOS project in Visual Studio Community 2022 (64-bit) Version 17.14.19 on my iPad Air.

Why is the iOS project not working in Visual Studio Community Insiders? Is it better to create new iOS projects in Visual Studio Community Insiders instead of using old Visual Studio Community 2022 projects in VS Insiders?

Developer technologies | .NET | .NET MAUI
{count} votes

2 answers

Sort by: Most helpful
  1. Tony Dinh (WICLOUD CORPORATION) 4,400 Reputation points Microsoft External Staff
    2025-10-28T07:49:55.1166667+00:00

    Hello @Kim Strasser !

    This is a common build issues in .NET iOS projects (often MAUI or Xamarin.iOS). These stem from the IL Linker (formerly IL Trimmer), a tool that optimizes .NET assemblies for iOS by trimming unused code and creating a linked output.

    Your project builds fine in VS 2022 (v17.14.19) because that version uses more stable, mature toolchains for .NET (likely .NET 8 or earlier). In VS 2026 Insiders (build 11123.170), you're targeting .NET 9.0-iOS, which introduces experimental changes to the linker and SDK that can cause instability in pre-release builds.

    Following reported cases for this similar issue, here are steps you can try as they resolve 80% mostly:


    Clean and Rebuild Everything:

    • In VS 2026, right-click your solution > Clean Solution, then delete the bin and obj folders manually from File Explorer.
      • Rebuild (Build > Rebuild Solution). This is ensure some stale artifacts from VS 2022 can not conflict with .NET 9's linker.

    Disable Linking Temporarily:

    • Right-click your iOS project > Properties > iOS Build tab.
      • Uncheck Enable link all (or set Linker Behavior to "Don't Link").
      • Rebuild and debug.
      • If it works, the issue is linker-specific. You can report it via Help > Send Feedback in VS.

    Verify Remote Mac Setup: Linking happens remotely; network/server errors (e.g., "Cannot execute process on server") are common culprits.

    • Ensure your Mac (with Xcode 16+ and .NET 9 SDK) is paired correctly: Tools > iOS > Pair to Mac.
      • Test the connection: Run dotnet workload install ios on the Mac via SSH.
      • Restart VS and reconnect.

    Check/Update Provisioning and Signing: .NET 9 enforces stricter checks, and old profiles from VS 2022 may expire or mismatch.

    • In Project Properties > iOS > Bundle Signing, ensure Automatic Provisioning is selected and your Apple Developer account is linked.
      • Refresh profiles: Xcode on Mac > Preferences > Accounts > Download Manual Profiles.

    Downgrade Target Framework: You can sticks closer to your VS 2022 setup. Upgrade back once stable.

    • Edit your .csproj: Change <TargetFramework>net9.0-ios</TargetFramework> to <TargetFramework>net8.0-ios</TargetFramework>.
      • Restore NuGet packages and rebuild.

    I hope this helps! Let me know if you stuck anywhere! If you find this answer useful, kindly mark this as final answer to your question!


  2. Tony Dinh (WICLOUD CORPORATION) 4,400 Reputation points Microsoft External Staff
    2025-11-03T03:40:05.0233333+00:00

    Hello @Kim Strasser !

    If your project targets net9.0-ios (uses .NET 9 SDK/runtime packs), VS 2022 will likely not have the matching runtime/workloads and will fail unless you change the target to a framework VS 2022 supports (for example net8.0-ios).

    In case if you want to use VS 2022 for debugging on your iPad:

    • Change the project target framework to net8.0-ios and ensure you have the .NET 8 iOS workload installed on the machine running VS 2022. Then open and debug in VS 2022.
      • Or install the needed .NET 9 workloads on the machine with VS 2022 (not guaranteed to be supported/stable).
      • Safer: keep using VS 2022 for active work by creating a compatible project (net8.0) or wait for the Insiders regression to be fixed if you must target net9.0.

    Regarding to the currnet issue you facing, these are the complete cover troubleshoot steps I can give; you can quick perform and ensure to align these steps again:

    1. Clean fully and remove stale state
      • Close Visual Studio.
      • Delete the project's bin and obj folders entirely (recursively).
      • Reopen VS Insiders and rebuild.
    2. Repair/align workloads and SDKs
      • open and run PowerShell following this command:
        • dotnet workload repair
        • dotnet --list-sdks (confirm expected SDKs installed)
        • dotnet workload install microsoft-ios
      • Restart the machine after repair and rebuild.
    3. Check filesystem permissions & locking
      • Run Visual Studio as Administrator and rebuild.
      • Temporarily disable real‑time antivirus/Windows Defender or add your repo folder to exclusions, then rebuild.
      • Ensure no other process (Explorer, Indexer, source-control hooks) holds locks on obj\Debug.
    4. Confirm path length / characters
      • Move the solution to a short path (e.g., C:\repos\ProjectTest) and try a rebuild to rule out MAX_PATH problems or problematic characters in the user name.
    5. Use MtouchLink setting exactly as required
      • For iOS debug builds Visual Studio enforces trimming rules. Use MtouchLink=None (not just PublishTrimmed) in the Debug configuration as you already tried:
        • <MtouchLink>None</MtouchLink>
      • Keep PublishTrimmed as True if the tooling enforces it; the important setting to disable trimming is MtouchLink.
    6. Collect a diagnostic build log (if the error persists)
      • Build with diagnostic verbosity: Tools → Options → Projects and Solutions → Build and Run → set MSBuild project build output verbosity to Diagnostic, then rebuild and inspect where it fails, or run msbuild /v:diag from Developer Command Prompt to capture exact error and stack.

    Create a minimal new .NET 9 iOS app in VS Insiders and build. If a minimal new project also fails, then you can treat it as an Insiders/SDK regression.


    Hope you resolve your issues!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.