SupportClass StopBackgroundCalls aborts thread causing ThreadAbortException
Options
I currently get ThreadAbortExceptions and after some investigation it seems to be caused by an unhandled exception in:
Any ideas on this please?
public static bool StopBackgroundCalls(byte id) { if (SupportClass.threadList == null || (int) id > SupportClass.threadList.Count || SupportClass.threadList[(int) id] == null) return false; SupportClass.threadList[(int) id].Abort(); return true; }PUN v2.12
Any ideas on this please?
0
Comments
-
Does not occur in unity editor but can be found in UWP build0
-
-
Hi @wassx,
There are issues cropping up in Unity 2019 and we would not be surprised if this is fixed since the original release.
Please update Unity and try to repro.
release history of 2019.1.1:IL2CPP: Fixed an intermittent crash when a managed exception occurs on a back ground thread while the process is shutting down.
release history of 2019.1.2:Services: Fix crash in signal handler on Android IL2CPP ARM641 -
If this really happens in UWP, this should be reported to Unity as a bug. For UWP, we use a ThreadPoolTimer. To stop this, we use timer.Cancel which has no exception:wassx said:Does not occur in unity editor but can be found in UWP build
https://docs.microsoft.com/en-us/uwp/api/windows.system.threading.threadpooltimer.cancel
On all other builds, we start catching the exception of the Thread. This comes in PUN v4.13 (or more precisely in the lib it will contain: v4.1.2.16).1 -
Hey @wassx
ICYMI:
PUN 2.13 is out with a new library v4.1.2.16 in its changelog:
"Fixed: Each thread created via SupportClass.StartBackgroundCalls will now try-catch a ThreadAbortException. Apparently, the handling of a ThreadAbortException changed with Unity 2019, which started to log the exceptions on IL2CPP, 4.x runtime."0