Description
Description
After upgrading my iOS app from classic Xamarin.iOS to .NET7 I started observing frequent InvalidCastExeption
s in my crash reporting tool (AppCenter). I haven't changed much dependency-wise and I am unable to reproduce this locally.
Reproduction Steps
Unfortunately, I don't know what part of my code causes this behavior.
For the first stack trace, I assume that my code (or some dependencies code) is creating a CancellationTokenSource
with a delay parameter.
For the second stack trace below, I assume that some call to Task.Delay
is causing the crash.
Expected behavior
No crash :)
Actual behavior
SIGABRT: Arg_InvalidCastException
System.Threading.CancellationTokenSource.TimerCallback(Object )
System.Threading.TimerQueueTimer.CallCallback(Boolean )
System.Threading.TimerQueueTimer.Fire(Boolean )
System.Threading.TimerQueue.FireNextTimers()
System.Threading.TimerQueue.System.Threading.IThreadPoolWorkItem.Execute()
System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(Object , Thread )
this is here:
SIGABRT: Arg_InvalidCastException
System.Threading.Tasks.Task.DelayPromise.TimerCallback(Object )
System.Threading.TimerQueueTimer.CallCallback(Boolean )
System.Threading.TimerQueueTimer.Fire(Boolean )
System.Threading.TimerQueue.FireNextTimers()
System.Threading.TimerQueue.System.Threading.IThreadPoolWorkItem.Execute()
System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(Object , Thread )
this is here:
Both crashes originate from here:
The "_state" variable is nullable, and based on the reports, the crashes are caused by the variable to be indeed null.
Regression?
I did not see those crashes when using "old" Xamarin.iOS
Known Workarounds
No response
Configuration
.net7-ios
happens on various iPhone models and iOS versions
Other information
No response