Commit a2bbad7
authored
[HotReloadAgent] Handle unsupported platform for
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.PosixSignalRegistration (#52466)1 parent 6cadd91 commit a2bbad7
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
0 commit comments