You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This experience seems to be new. I wrote a test app with an intentional crash scenario to test something. This is what I saw. Not a problem, just (A) is this new?, and (B) FYI.
The post goes on to say that the debugger is off by default for macOS, maybe they turned it on by default in macOS 26.
If we don't like it I suppose we could set environment variable SWIFT_BACKTRACE to enable=no on start up, if the environment variable is unset. That way folks can turn it on if they want.
Note that the runtime will not install its signal handlers for a signal if it finds that there is already a handler for that signal. Similarly if something else has already configured an alternate signal stack, it will leave that stack alone.
This is interesting and I wonder if Apple's exception handling will collide with our own, since it mentions configuring alternate stacks.
FYI: I am now one beta build back. Another came out (I think) last week. I'm in the middle of a project and have been delaying upgrading until I get to a clean spot (and can push my changes). It's possible that the beheavior changes in the next build. perhaps someone else has that installed.
@jkotas / @agocke Where in the product would we go about disabling this by default? I presume we'd need to introduce our own ENV var to disable us disabling it too.
Where in the product would we go about disabling this by default?
I don't know how easy this is to do by environment variable. This needs to be done very early in application startup - before the managed Main. I can't disable it programmatically from my own program.
We pinged Apple about this and the swift backtrace handler running was an intentional change. The guidance they provided is to either have a dummy signal handler that just returns or set the SWIFT_BACKTRACE env variable to enable=no. They did say it was important to note that the environment variable is only checked on process startup (when the static initializers for the swift runtime execute).
For our case, it does not seem like there's any harm in using the environment variable.
For our case, it does not seem like there's any harm in using the environment variable.
One noticeable issue would be custom hosting scenarios like Unity, since they'd need to set the variable themselves since dotnet might only be loaded later on in program lifetime.
One noticeable issue would be custom hosting scenarios like Unity, since they'd need to set the variable themselves since dotnet might only be loaded later on in program lifetime.
Regardless of environment variable or signal handler, it seems to me it needs to be something to host does. The host can set the environment variable (early) or it can set the signal handler. If the runtime attempts to set the signal handler or environment variable then it might be too late - the swift runtime will have already set up BacktraceInitializer.
So, has this issue been fixed in the latest .NET 10 version? I have currently found that Avalonia .NET 10 applications cannot be captured by global exception handlers when they crash, and I'm not sure if this is caused by the same reason.
Activity
[-]New crash handler in macOS 26[/-][+]New crash handler in macOS 26?[/+]vcsjones commentedon Aug 17, 2025
This looks like the Swift crash handler. https://www.swift.org/blog/swift-5.9-backtraces/
The post goes on to say that the debugger is off by default for macOS, maybe they turned it on by default in macOS 26.
If we don't like it I suppose we could set environment variable SWIFT_BACKTRACE to
enable=noon start up, if the environment variable is unset. That way folks can turn it on if they want.vcsjones commentedon Aug 17, 2025
From Apple's docs:
This is interesting and I wonder if Apple's exception handling will collide with our own, since it mentions configuring alternate stacks.
cc @janvorli
richlander commentedon Aug 18, 2025
@hoyosjs @steveisok
richlander commentedon Aug 18, 2025
FYI: I am now one beta build back. Another came out (I think) last week. I'm in the middle of a project and have been delaying upgrading until I get to a clean spot (and can push my changes). It's possible that the beheavior changes in the next build. perhaps someone else has that installed.
richlander commentedon Aug 18, 2025
For kicks, this is the code I was running: https://gist.github.com/richlander/d5f8cf2b6fb0fce45a336a387c3858ff
vcsjones commentedon Aug 18, 2025
I can reproduce this on Preview 7. Any second change managed exception causes it. A simple 1-line program:
Will invoke the Swift debugger.
This is with .NET 10 preview 7 and macOS 26 preview 7. I am not using a debug build of the runtime.
Doing
SWIFT_BACKTRACE="enable=no" dotnet rundoes indeed disable the swift backtrace handler.jeffhandley commentedon Aug 18, 2025
@jkotas / @agocke Where in the product would we go about disabling this by default? I presume we'd need to introduce our own ENV var to disable us disabling it too.
vcsjones commentedon Aug 18, 2025
I don't know how easy this is to do by environment variable. This needs to be done very early in application startup - before the managed
Main. I can't disable it programmatically from my own program.richlander commentedon Aug 18, 2025
FYI: I believe this is ship-stopper issue.
41 remaining items
steveisok commentedon Sep 10, 2025
We pinged Apple about this and the swift backtrace handler running was an intentional change. The guidance they provided is to either have a dummy signal handler that just returns or set the
SWIFT_BACKTRACEenv variable toenable=no. They did say it was important to note that the environment variable is only checked on process startup (when the static initializers for the swift runtime execute).For our case, it does not seem like there's any harm in using the environment variable.
MichalPetryka commentedon Sep 10, 2025
One noticeable issue would be custom hosting scenarios like Unity, since they'd need to set the variable themselves since dotnet might only be loaded later on in program lifetime.
vcsjones commentedon Sep 10, 2025
Regardless of environment variable or signal handler, it seems to me it needs to be something to host does. The host can set the environment variable (early) or it can set the signal handler. If the runtime attempts to set the signal handler or environment variable then it might be too late - the swift runtime will have already set up
BacktraceInitializer.agocke commentedon Sep 22, 2025
This should be mitigated by #119920, but I don't know if we want to do something else for .NET 11.
jkotas commentedon Sep 22, 2025
Duplicate or related to #113707
LIJIAOLONG96 commentedon Nov 20, 2025
So, has this issue been fixed in the latest .NET 10 version? I have currently found that Avalonia .NET 10 applications cannot be captured by global exception handlers when they crash, and I'm not sure if this is caused by the same reason.
agocke commentedon Nov 20, 2025
@869570967 The behavior in .NET 10 is the same as in .NET 9, so it should be fixed in that sense.
jkotas commentedon Nov 20, 2025
You may want to create a new issue about this with details. It is not clear what you mean by "global exception handlers".
LIJIAOLONG96 commentedon Nov 20, 2025
AppDomain.CurrentDomain.UnhandledException
TaskScheduler.UnobservedTaskException
I mean, these two events stopped working on macOS.
jkotas commentedon Nov 20, 2025
Open an issue on this with repro steps and the behavior that you are seeing.
LIJIAOLONG96 commentedon Nov 20, 2025
ok