[HotReloadAgent] Handle unsupported platform for PosixSignalRegistration#52466
Merged
jonathanpeppers merged 1 commit intorelease/10.0.3xxfrom Jan 22, 2026
Merged
Conversation
Member
Author
|
Note that I'll send this to |
tmat
requested changes
Jan 14, 2026
Member
tmat
left a comment
There was a problem hiding this comment.
LGTM. Do not merge to 2xx though.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a PlatformNotSupportedException crash that occurs when running the HotReload agent on platforms where PosixSignalRegistration is not supported (Android, iOS, tvOS, and Browser). The fix adds a platform check before attempting to register POSIX signal handlers.
Changes:
- Introduces a new
s_supportsPosixSignalsboolean field to track platform support - Adds a conditional check in
RegisterSignalHandlers()to skip POSIX signal registration on unsupported platforms
51 tasks
Member
Author
|
@tmat retargeted to |
…tion`
If running on Android, for example, you can get the following exception:
01-14 10:46:37.635 28537 28537 F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
01-14 10:46:37.635 28537 28537 F mono-rt : ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Runtime.InteropServices.PosixSignalRegistration.Register(PosixSignal signal, Action`1 handler)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Runtime.InteropServices.PosixSignalRegistration.Create(PosixSignal signal, Action`1 handler)
01-14 10:46:37.635 28537 28537 F mono-rt : at StartupHook.RegisterSignalHandlers()
01-14 10:46:37.635 28537 28537 F mono-rt : at StartupHook.InitializeWithHttp(String processDir)
01-14 10:46:37.635 28537 28537 F mono-rt : at StartupHook.Initialize()
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
01-14 10:46:37.635 28537 28537 F mono-rt : --- End of inner exception stack trace ---
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.StartupHookProvider.CallStartupHook(StartupHookNameOrPath startupHook)
01-14 10:46:37.635 28537 28537 F mono-rt : at System.StartupHookProvider.ProcessStartupHooks(String diagnosticStartupHooks)
Just like in 79e5fa6, `PosixSignalRegistration` APIs are decorated
with:
[UnsupportedOSPlatform("android")]
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
public static PosixSignalRegistration Create(PosixSignal signal, Action<PosixSignalContext> handler);
This is used for handling Ctrl+C, for example, which we'll likely
implement a different way for mobile platforms.
For now, let's not run the `PlatformNotSupportedException`-throwing
code on unsupported platforms.
7a00d5f to
4996257
Compare
tmat
approved these changes
Jan 21, 2026
This was referenced Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If running on Android, for example, you can get the following exception:
Just like in 79e5fa6,
PosixSignalRegistrationAPIs are decorated with:This is used for handling Ctrl+C, for example, which we'll likely implement a different way for mobile platforms.
For now, let's not run the
PlatformNotSupportedException-throwing code on unsupported platforms.