Skip to content

dotnet watch fails when targeting sandboxed maccatalyst apps #25700

Closed

Description

@vitek-karas

This was tested using .NET 11 Preview 5.

dotnet new maui
dotnet watch -> select net11.0-maccatalyst

On mono it fails with:

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x100748150 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_dump_native_crash_info
	0x1006ff620 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_handle_native_crash
	0x1008de844 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : sigabrt_signal_handler.cold.1
	0x100747a14 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_runtime_setup_stat_profiler
	0x1854e3744 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x1854d98d8 - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
	0x1853e0644 - /usr/lib/system/libsystem_c.dylib : abort
	0x1004e0e78 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : xamarin_register_assembly
	0x1004e12b0 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : xamarin_print_all_exceptions_wrapper
	0x1004e4388 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : xamarin_print_all_exceptions
	0x1004e4a4c - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : xamarin_unhandled_exception_handler
	0x100600424 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_invoke_unhandled_exception_hook
	0x1006ff4bc - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_handle_exception_internal
	0x1006fdb20 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_handle_exception
	0x100744734 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_arm_throw_exception
	0x1004b057c - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : throw_exception
	0x1006491e8 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mono_runtime_run_startup_hooks
	0x100697888 - /Users/<user>/repro/maui/mp5debug/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/mp5debug.app/Contents/MacOS/mp5debug : mini_init

On CoreCLR it fails with:

Unhandled exception. System.ArgumentException: Startup hook assembly '/Users/<user>/.dotnet.install/11.0.P5/sdk/11.0.100-preview.5.26302.115/DotnetTools/dotnet-watch/11.0.100-preview.5.26302.115/tools/net11.0/any/hotreload/net10.0/Microsoft.Extensions.DotNetDeltaApplier.dll' failed to load. See inner exception for details.
 ---> System.IO.FileLoadException: Could not load file or assembly '/Users/<user>/.dotnet.install/11.0.P5/sdk/11.0.100-preview.5.26302.115/DotnetTools/dotnet-watch/11.0.100-preview.5.26302.115/tools/net11.0/any/hotreload/net10.0/Microsoft.Extensions.DotNetDeltaApplier.dll'. Access is denied.

File name: '/Users/<user>/.dotnet.install/11.0.P5/sdk/11.0.100-preview.5.26302.115/DotnetTools/dotnet-watch/11.0.100-preview.5.26302.115/tools/net11.0/any/hotreload/net10.0/Microsoft.Extensions.DotNetDeltaApplier.dll'
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyBinder, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.StartupHookProvider.CallStartupHook(StartupHookNameOrPath startupHook)
   --- End of inner exception stack trace ---
   at System.StartupHookProvider.CallStartupHook(StartupHookNameOrPath startupHook)
   at System.StartupHookProvider.ProcessStartupHooks(String diagnosticStartupHooks)
   at System.StartupHookProvider.ManagedStartup(Char* pDiagnosticStartupHooks, Exception* pException)

This only happens on maccatalyst - using iOS simulator works.

Activity

  1. rolfbjarne commented on Jun 16, 2026

    @rolfbjarne
    Member

    Unhandled exception. System.ArgumentException: Startup hook assembly '/Users//.dotnet.install/11.0.P5/sdk/11.0.100-preview.5.26302.115/DotnetTools/dotnet-watch/11.0.100-preview.5.26302.115/tools/net11.0/any/hotreload/net10.0/Microsoft.Extensions.DotNetDeltaApplier.dll' failed to load. See inner exception for details.
    ---> System.IO.FileLoadException: Could not load file or assembly '/Users//.dotnet.install/11.0.P5/sdk/11.0.100-preview.5.26302.115/DotnetTools/dotnet-watch/11.0.100-preview.5.26302.115/tools/net11.0/any/hotreload/net10.0/Microsoft.Extensions.DotNetDeltaApplier.dll'. Access is denied.

    This is because the Mac Catalyst app is in sandbox mode (the default). Disabling sandbox mode (in Platforms/MacCatalyst/Entitlements.plist) gets passed this, and then another error shows up, which is due to the trimmer being enabled (already filed here: #25295). If that's fixed too (by setting MtouchLink=None in the csproj), dotnet watch works for me.

    Disabling the linker also makes it work when using Mono, so I'll leave this issue for the sandbox problem.

  2. changed the title [-]dotnet watch fails when targeting maccatalyst[/-] [+]dotnet watch fails when targeting sandboxed maccatalyst apps[/+] on Jun 16, 2026
  3. added
    Mac Catalyst
    on Jun 16, 2026
  4. rolfbjarne commented on Jun 16, 2026

    @rolfbjarne
    Member

    Presumably the sandbox problem also exists for macOS apps, the difference is that the sandbox isn't enabled by default for macOS apps.

  5. added
    macOS
    bug
    on Jun 16, 2026
  6. added theissue type on Jun 16, 2026
  7. added this to the .NET 11 milestone on Jun 16, 2026
  8. rolfbjarne commented on Jun 16, 2026

    @rolfbjarne
    Member

    The fix might actually be related to the fix for #25408, because the fix for both would be to:

    • add the hot reload assembly to the app
    • redirect/rewrite arguments/env vars so that the app loads the hot reload assembly from the in-app location

    Note that the sandbox isn't enforced for simulator apps, which is why this is not needed there.

  9. rolfbjarne commented on Jul 1, 2026

    @rolfbjarne
    Member

    This is fixed now (for P7).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Mac CatalystbugmacOS

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions