Description
Description
reproduces absolutely randomly both in debug and in release mode, appeared after switching from net8-ios to net9-ios (It doesn't seem like it applies to iOS)
stacktrace of InvalidCastException:
System.InvalidCastException: Specified cast is not valid.
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)
at System.Threading.Tasks.Task.Finish(Boolean userDelegateExecute)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
at System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(Object workItem, Thread currentThread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
stacktrace of InvalidOperationException (from Sentry):
System.InvalidOperationException: Arg_InvalidOperationException
?, in void ManualResetValueTaskSourceCore.SignalCompletion()
?, in void ManualResetValueTaskSourceCore.SetResult(long)
?, in void ThreadPoolValueTaskSource.ExecuteInternal()
?, in void ThreadPoolValueTaskSource.System.Threading.IThreadPoolWorkItem.Execute()
?, in void ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(object, Thread)
?, in bool ThreadPoolWorkQueue.Dispatch()
?, in void WorkerThread.WorkerThreadStart()
also screenshot from debug session (from AppDomain.CurrentDomain.UnhandledException):
Reproduction Steps
have not steps
Expected behavior
no crashes
Actual behavior
crash occurs
Regression?
works in net8-ios
Known Workarounds
No response
Configuration
net9, ios 18
Other information
No response