Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[net9] System.Private.CoreLib occurs InvalidOperationException and InvalidCastException #114262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sleushunou opened this issue Apr 4, 2025 · 49 comments

Comments

@sleushunou
Copy link

sleushunou commented Apr 4, 2025

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):

Image

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

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 4, 2025
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas added the runtime-mono specific to the Mono runtime label Apr 4, 2025
@TDiblik
Copy link

TDiblik commented Apr 5, 2025

hey, i would love to look into this, could you please provide a minimal reproducible example?

@sleushunou
Copy link
Author

so far it's very difficult for me to understand where this is being reproduced: the project is very large, the stack trace is absolutely uninformative for me

@sleushunou
Copy link
Author

perhaps you can find breaking changes that occurred during the transition from net8 to net9 based on the stack trace

@sleushunou
Copy link
Author

dotnet/maui#28197

i found similar issue

@a1exv
Copy link

a1exv commented Apr 9, 2025

Happens for us in random places in the iOS in release mode. This is a blocker to go for net9

@afk013
Copy link

afk013 commented Apr 9, 2025

TLDR: Just to add a me too to this issue though our situation we can only repeat in a release mode and we only get InvalidCastException

This crash has only been recreated by us using a release-built iOS app with the default template AOT and trimming settings enabled. Attempting to create repro steps has been difficult as the crash is intermittent in that it seemingly can occur anywhere in the app however will occur multiple times within the span of a couple of hours for any given device (sometimes within 5 minutes of app start to around 1.5 hours of use).

It seems to happen during periods of heavy activity such as background syncing and the UI reacting to data changes or during page navigation.



Exception details:

*** Terminating app due to uncaught exception 'SIGABRT', reason: 'Arg_InvalidCastException'



Xamarin Exception Stack:

System.InvalidCastException: Arg_InvalidCastException

at System.Threading.Tasks.Task.RunContinuations(Object )

at System.Threading.Tasks.Task.FinishStageThree()

at System.Threading.Tasks.Task.FinishStageTwo()

at System.Threading.Tasks.Task.Finish(Boolean )

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )

at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread )

at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread )

at System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(Object , Thread )

at System.Threading.ThreadPoolWorkQueue.Dispatch()

at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

This issue does look very similar to the issue raised here: #81211 however this was resolved in .Net MAUI 8 RC2 and we are using .Net MAUI 9.0.50 SR5.


We did have a theory that possibly the exception was being raised within an event handler that was using async void. To rule this out we have used the package: https://github.com/roubachof/Sharpnado.TaskMonitor to revert all event handlers back to returning void and if any tasks within these methods throw an exception this is now handled within a global error handler. Sadly, while this approach is definitely better moving forward it was not the cause of the unhandled exception we are experiencing on iOS.

@pme442
Copy link

pme442 commented Apr 9, 2025

Well, add me to this, too. Happening in release mode .Net MAUI 9.0.10. It's very random (could happen while refreshing a ListView, closing a modal page, opening a modal page, toggling a Switch control, displaying an activity indicator etc.).
Very, very similar to what @afk013 describes.

That being said, what is the game plan here?
Up until now, I've been able to support our users and provide emergency bug fixes via the Xamarin Forms app.
However, in 2 weeks, I will no longer be able to do this due to the April 2025 App Store Xcode requirement.
Since I've converted to Maui, performance has taken a hit. It runs poorly on any device with less than 3GB of RAM. I've done everything that the Maui documents encourage me to do to help performance (compiled bindings, simplified layouts etc.). Our app is complex with heavy processing due to business requirements that I can't change. Xamarin Forms handled it like a dream. So I was quite disappointed after all the work I've put into converting it to Maui.
Aside from that, I'm not at all comfortable releasing the Maui app since this issue, in particular, makes it unstable.

@steveisok
Copy link
Member

That being said, what is the game plan here?

We're in the process of triaging to determine what the problem is. If we're able to pin it down, I'm hopeful we'll be able to suggest workarounds better than falling back to the interpreter.

If anyone can provide a simple repro, that would help speed everything up.

@HarlanHugh
Copy link

Just commenting to say we are seeing the same issue. Only happens when using net9 on iOS. Also appears randomly and without any obvious pattern.

@wgriep
Copy link

wgriep commented Apr 10, 2025

We have the same issue when we run our Maui app on iOS without the VS debugger attached. When the debugger is attached, we never get the exception. Our project is quite complex and haven't tried to isolate this with a repro, but can provide some background in hopes it helps:
Visual Studio Version 17.13.5
dotnet workload list:

Installed Workload Id Manifest Version Installation Source

android 35.0.50/9.0.100 SDK 9.0.200, VS 17.13.35919.96
aspire 8.2.2/8.0.100 SDK 9.0.200, VS 17.13.35919.96
ios 18.2.9180/9.0.100 SDK 9.0.200, VS 17.13.35919.96
maccatalyst 18.2.9180/9.0.100 SDK 9.0.200, VS 17.13.35919.96
maui 9.0.14/9.0.100 SDK 9.0.200
maui-windows 9.0.14/9.0.100 SDK 9.0.200, VS 17.13.35919.96
wasm-tools 9.0.3/9.0.100 SDK 9.0.200, VS 17.13.35919.96

Project has <UseInterpreter>True</UseInterpreter>

Packages:

  • Camera.MAUI" Version="1.5.1"
  • Camera.MAUI.ZXing" Version="1.0.0"
  • CommunityToolkit.Maui" Version="11.2.0"
  • MetroLog.Maui" Version="2.1.0"
  • Microsoft.Maui.Controls" Version="9.0.50"
  • Microsoft.Maui.Controls.Compatibility" Version="9.0.50"
  • Microsoft.Extensions.Logging.Debug" Version="9.0.3"
  • Esri.ArcGISRuntime.Maui" Version="200.6.0"
  • Esri.ArcGISRuntime.Toolkit.Maui" Version="200.6.0"
  • MetroLog.Net6" Version="2.1.0"
  • Newtonsoft.Json" Version="13.0.3"
  • Plugin.Maui.Audio" Version="3.1.0"
  • Sentry.Maui" Version="5.5.0"
  • SkiaSharp" Version="3.116.1"
  • SkiaSharp.Views.Maui.Controls" Version="3.116.1"
  • Svg.Skia" Version="2.0.0.4"
  • System.Private.Uri" Version="4.3.2"
  • Telerik.UI.for.Maui" Version="10.1.0"
  • Microsoft.Graph" Version="5.75.0"
  • Microsoft.Identity.Client" Version="4.70.0"
  • Microsoft.Identity.Client.Broker" Version="4.70.0"
  • Microsoft.Identity.Client.Extensions.Msal" Version="4.70.0"
  • Websocket.Client" Version="5.1.2"
  • ZXing.Net.Maui.Controls" Version="0.4.0"

Process that causes the crashes:
We have 280 files downloading (total of 20+ GB). These downloads are processed using Parallel.ForEachAsync (MaxDegreeOfParallelism = 5 yet setting to 1 or not setting doesn't matter) and use HttpClient within the loop to download the file.

We have added try catch around everything, but the exception bubbles up to AppDomain.CurrentDomain.UnhandledException.

Note that the same code works with dotnet 8.

@steveisok
Copy link
Member

Process that causes the crashes: We have 280 files downloading (total of 20+ GB). These downloads are processed using Parallel.ForEachAsync (MaxDegreeOfParallelism = 5 yet setting to 1 or not setting doesn't matter) and use HttpClient within the loop to download the file.

We have added try catch around everything, but the exception bubbles up to AppDomain.CurrentDomain.UnhandledException.

Note that the same code works with dotnet 8.

Not sure if this has been suggested, but can you set <UseNativeHttpHandler>false</UseNativeHttpHandler> in your csproj? That will use SocketsHttpHandler instead interoping with the native iOS one. Might be a clue if it does work for you.

@wgriep
Copy link

wgriep commented Apr 11, 2025

Process that causes the crashes: We have 280 files downloading (total of 20+ GB). These downloads are processed using Parallel.ForEachAsync (MaxDegreeOfParallelism = 5 yet setting to 1 or not setting doesn't matter) and use HttpClient within the loop to download the file.
We have added try catch around everything, but the exception bubbles up to AppDomain.CurrentDomain.UnhandledException.
Note that the same code works with dotnet 8.

Not sure if this has been suggested, but can you set <UseNativeHttpHandler>false</UseNativeHttpHandler> in your csproj? That will use SocketsHttpHandler instead interoping with the native iOS one. Might be a clue if it does work for you.

Thanks for the suggestion. We tried <UseNativeHttpHandler>false</UseNativeHttpHandler> but unfortunately it doesn't solve the problem.

We also experience the same exceptions in a long running Parallel.ForEachAsync that unzips these files after downloading.

It seems the more items we are putting thru the ForEachAsync, the higher probability we have for the exception to occur.

@steveisok
Copy link
Member

Thanks for the suggestion. We tried <UseNativeHttpHandler>false</UseNativeHttpHandler> but unfortunately it doesn't solve the problem.

We also experience the same exceptions in a long running Parallel.ForEachAsync that unzips these files after downloading.

It seems the more items we are putting thru the ForEachAsync, the higher probability we have for the exception to occur.

Appreciate you trying it out and letting me know. I'll add ForEachAsync to the list of things we'll try.

@Illyaaa
Copy link

Illyaaa commented Apr 15, 2025

We facing with the same problem. The app crashes randomly with Arg_InvalidCastException exception with the same stack as provided above. We just moved the app from Xamarin forms to MAUI9 and facing with this issue on release builds only. I was not able to reproduce it locally.
The app periodically syncing data with the backend by making 14 http requests at the same time and updating data in the local sqlite database. To work with database we use sqlite-net-pcl 1.9.172. According to Sentry breadcrumbs and the app logs, the crash always happening somewhere in the end of the sync iteration, but this happening not that often, usually it's finishing without any issues. I assume that this is somehow related to running multiple tasks in parallel or waiting them using Task.WhenAll.
We were facing the issue when using MAUI 9.0.50(workload version is 9.0.14/9.0.100). Today we updated MAUI to 9.0.60 and testing. I will update if it helps.

@Illyaaa
Copy link

Illyaaa commented Apr 15, 2025

Updating MAUI to 9.0.60 didn't help

@EmilienDup
Copy link

EmilienDup commented Apr 16, 2025

We are also facing the same problem on iOS, while using MAUI version 9.0.70-ci.main.25216.1 in Release configuration.

Same situation as others, it occurs "at random", and on various pages.
We couldn't find an exact pattern to reproduce the problem.

Definitely a blocker for us.

If it can help, here is the IOS project Release build configuration.

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <CodesignKey>iPhone Distribution</CodesignKey>
    <MtouchLink>SdkOnly</MtouchLink>
    <UseInterpreter>true</UseInterpreter>
  </PropertyGroup>

@jeffhandley jeffhandley added this to the 10.0.0 milestone Apr 17, 2025
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 17, 2025
@wgriep
Copy link

wgriep commented Apr 21, 2025

@jeffhandley since you have moved this to a future milestone, does that mean it won't be fixed for dotnet 9? Has the issue been identified? Are there any workarounds? This is a major setback for our software if there is no resolution or workaround for dotnet 9.

@steveisok
Copy link
Member

@jeffhandley since you have moved this to a future milestone, does that mean it won't be fixed for dotnet 9? Has the issue been identified? Are there any workarounds? This is a major setback for our software if there is no resolution or workaround for dotnet 9.

We are still investigating and will relay any kind of workarounds / fixes when we determine what the problem is. Rest assured, it has our full attention.

@pme442
Copy link

pme442 commented Apr 22, 2025

OK, I have a repo app here: https://github.com/pme442/CVIssueApp

I deployed this to my iPad mini 6th Gen (4GB of RAM) and ran in release mode.
This is an extremely watered down version of what my app is doing. It took me about 5 to 6 days (starting over 3 times) to get the exception to happen. I'll be honest, it is frustrating to get this to happen. It's almost like it has to hit the perfect storm. Maybe something like a background task running, while the GC is running, while the UI is updating? I don't know.

In this app, there are 3 tabs at the bottom:
1 - Collection Views: You can ignore this one.
2 - List Views: This is where you will answer the questions.
3 - Error Log: Every time you navigate here, it will append a message displaying the current memory used and total available memory. It will also log a record for each time the app is started, any apple memory warnings and any unhandled exceptions.

General Notes on how it works:

  1. Every time you answer a question it will do some dummy async task processing.
  2. If your answer contains a lowercase "o", it will do some extra processing.
  3. For the text questions, you can either press the purple "Done" button in the popup window, OR you can press the "done" key on the soft keyboard -- both will "save" the response and close the popup. So, if you are right-handed, you can pretty easily press the o and then the "done" key quickly.
  4. There is a green Reset button in the bottom left corner of the screen. If you press that, it will clear and reload all of the questions.

Here is what I did:
Go to the List View tab and start answering questions. Sometimes I would start at the bottom and go up. Sometimes I would start at the top or middle.
For the most part, I was answering every text question with a lowercase "o". Also, I was doing it rather quickly.
Sometimes, as soon as the popup closed, I would quickly select the other category and reload all of those questions and then quickly scroll to the bottom and start answering them.
Sometimes, I would tap on one category then the other and repeat 5 or 6 times in a row just to hammer on the performance.
Sometimes, I would answer the first and last 20 questions in the 1st category, then answer the first and last 20 questions in the 2nd category, then hit the Reset button really fast and start over. The more rendering it has to do, the faster the used memory will grow.

After you do these things for about 15 to 20 minutes, go to the Error Log tab and see where you are with memory.
Once I got the used memory to be between 500,000,000 and 700,000,000, I would put the app in the background, or just turn off the screen and let it sit for a few hours. Then, I would pick it up and just answer and/or un-answer questions for 15 minutes or so, then let it sit overnight.
By the next morning, the memory is probably over 800,000,000 or even 900,000,000. If the GC runs and knocks that number down, I'd just scroll through the questions more and get it back up a little. But try not to do it too fast, because you could risk apple aborting it due to resource issues. If it crashes with nothing logged to the Error Log, look at the device's Privacy and Security -> Analytics and Improvements -> Analytics Data. If you just get a "cpu_resource.ips" report instead of a regular .ips report, then apple caused it. (This was the reason I had to start over my testing last week.)
So when I would get into the 800,000,000 - 900,000,000 range I would just go back to answering the first 10 or 11 questions of each category with o's and No's, hit the reset button, repeat. So very little scrolling. Could take a half hour or so of doing this but eventually it crashed.

Here is a screen shot of my Error Log:

Image

Hope this helps!

@marek-safar marek-safar removed this from the 10.0.0 milestone Apr 24, 2025
@marek-safar marek-safar added this to the 9.0.x milestone Apr 24, 2025
@janusw
Copy link

janusw commented Apr 30, 2025

We're seeing the same here with a .NET MAUI app on iOS. Total blocker for moving to .NET9.
Observed with MAUI versions 9.0.50 and 9.0.60 and SDKs 9.0.201 and 9.0.203 (runtime versions 9.0.3 and 9.0.4).

@steveisok
Copy link
Member

We're seeing the same here with a .NET MAUI app on iOS. Total blocker for moving to .NET9. Observed with MAUI versions 9.0.50 and 9.0.60 and SDKs 9.0.201 and 9.0.203 (runtime versions 9.0.3 and 9.0.4).

Thanks - any repro or description of what you are doing in the lead up would be helpful. Are you seeing this on certain device types more often than others?

@janusw
Copy link

janusw commented May 3, 2025

We're seeing the same here with a .NET MAUI app on iOS. Total blocker for moving to .NET9. Observed with MAUI versions 9.0.50 and 9.0.60 and SDKs 9.0.201 and 9.0.203 (runtime versions 9.0.3 and 9.0.4).

Thanks - any repro or description of what you are doing in the lead up would be helpful.

As others have reported here, we are also seeing crashes at random basically. The crashes have been observed in very different situations, including ones where the app is almost doing nothing at all (no user interactive for a while).

Are you seeing this on certain device types more often than others?

Not really. We've seen it on various devices (including, for example, iPhone 14, iPhone 8, iPad Air 4th gen), and with various iOS versions (16 -18). Since the crash is occurring rarely and at random, it's hard to say if it occurs "more often" on a specific device.

@janusw
Copy link

janusw commented May 3, 2025

Trying to approach this issue from the source-code side, I've looked at the blame of Task.RunContinuations.

There is only one commit that is recent enough (added between net8.0 and net9.0) and has potential for causing this issue:
7e5e2e7 by @pentp and @stephentoub.

It adds the following line in RunContinuations:

Span<object?> continuations = CollectionsMarshal.AsSpan(list);

Looking at the source of CollectionsMarshal.AsSpan, it makes the following assertions:

Debug.Assert(items is not null, "Implementation depends on List<T> always having an array.");
[..]
Debug.Assert(typeof(T[]) == list._items.GetType(), "Implementation depends on List<T> always using a T[] and not U[] where U : T.");

Could it be that the crash is caused by one of these assertions not being fulfilled for some reason?

The documentation of AsSpan says:

Items should not be added or removed from the List{T} while the Span{T} is in use.

So maybe the issue is caused by some sort of race condition, where the continuationObject parameter of RunContinuations is used/modified concurrently?

@janusw
Copy link

janusw commented May 3, 2025

There is only one commit that is recent enough (added between net8.0 and net9.0) and has potential for causing this issue: 7e5e2e7 by @pentp and @stephentoub.

It adds the following line in RunContinuations:

Span<object?> continuations = CollectionsMarshal.AsSpan(list);

[..]

So maybe the issue is caused by some sort of race condition, where the continuationObject parameter of RunContinuations is used/modified concurrently?

I see that there is some locking code in front of the AsSpan (which is supposed to avoid any such race conditions, I assume):

// Wait for any concurrent adds or removes to be retired
Monitor.Enter(list);
Monitor.Exit(list);
Span<object?> continuations = CollectionsMarshal.AsSpan(list);

However, the locking has also been modified in the commit above (from an acutal lock statement to using the Monitor class). And I find it somewhat unusual that the locking does not encompass the AsSpan line, but precedes it (which means that it technically does not guarantee to avoid all race conditions, right?).

While I cannot prove that the commit mentioned above is the culprit that introduced this regression, I still think it's the most probable cause.

[Note that I also blame-checked all the Task.Finish... and Task.Execute... methods that appear in the backterace, and apparently none of them have been modified recently.]

@janusw
Copy link

janusw commented May 3, 2025

Project has <UseInterpreter>True</UseInterpreter>

I'll note that, like @wgriep and @EmilienDup, we're setting UseInterpreter to True. However, since @pme442's repro project does not seem to do that, it might not actually matter (?).

Also, we use:

<TrimMode>partial</TrimMode>

@pentp
Copy link
Contributor

pentp commented May 4, 2025

There is only one commit that is recent enough (added between net8.0 and net9.0) and has potential for causing this issue: 7e5e2e7 by @pentp and @stephentoub.

It adds the following line in RunContinuations:

Span<object?> continuations = CollectionsMarshal.AsSpan(list);

This commit did not weaken any lock guarantees, all accesses to the continuations list are still done under lock (or after the last locking operation in case of RunContinuations).

@janusw
Copy link

janusw commented May 5, 2025

There is only one commit that is recent enough (added between net8.0 and net9.0) and has potential for causing this issue: 7e5e2e7 by @pentp and @stephentoub.

This commit did not weaken any lock guarantees, all accesses to the continuations list are still done under lock (or after the last locking operation in case of RunContinuations).

True, but shouldn't the access to the list in RunContinuations also be done "under lock" (not just "after the last locking operation")?

I.e. instead of ...

            Monitor.Enter(list);
            Monitor.Exit(list);
            Span<object?> continuations = CollectionsMarshal.AsSpan(list);

shouldn't it better be the following?

            Monitor.Enter(list);
            Span<object?> continuations = CollectionsMarshal.AsSpan(list);
            Monitor.Exit(list);

Otherwise another locked access might be done simulteneously, while AsSpan is already executing, right? (unlikely as it may be)

@janusw
Copy link

janusw commented May 5, 2025

This commit did not weaken any lock guarantees, all accesses to the continuations list are still done under lock (or after the last locking operation in case of RunContinuations).

True, but shouldn't the access to the list in RunContinuations also be done "under lock" (not just "after the last locking operation")?

            Monitor.Enter(list);
            Monitor.Exit(list);
            Span<object?> continuations = CollectionsMarshal.AsSpan(list);

Otherwise another locked access might be done simulteneously, while AsSpan is already executing, right? (unlikely as it may be)

Plus, this would not only be a problem while to conversion to Span is being executed, but also while that Span is being used, according to the AsSpan documentation:

Items should not be added or removed from the List{T} while the Span{T} is in use.

@janusw
Copy link

janusw commented May 5, 2025

Otherwise another locked access might be done simulteneously, while AsSpan is already executing, right? (unlikely as it may be)

Plus, this would not only be a problem while to conversion to Span is being executed, but also while that Span is being used, according to the AsSpan documentation:

Items should not be added or removed from the List{T} while the Span{T} is in use.

... and that is indeed a difference to the old .NET 8 implementation, where only the continuation count was determined up front, and could then be used safely in the subsequent loops.

Converting to Span up front and then using Span.Length in subsequent loops does not seem to be thread-safe without proper locking. And it probably does not even improve performance, if all you need from the Span is its length.

@stephentoub Could you possibly comment on this (as the reviewer of PR #93953)?

@pentp
Copy link
Contributor

pentp commented May 5, 2025

The operations in RunContinuations run after the task is marked completed and the lock is taken there just to guarantee all locking operations have completed. The locking there is still the same as before.

@janusw
Copy link

janusw commented May 5, 2025

The operations in RunContinuations run after the task is marked completed and the lock is taken there just to guarantee all locking operations have completed. The locking there is still the same as before.

Thanks for the comments, @pentp!

So, if you are sure that PR #93953 is not what caused this issue, do you possibly have an idea what else could cause InvalidCastExceptions in Task.RunContinuations with .NET 9 on iOS (which did not occur with .NET 8)?

@steveisok
Copy link
Member

So, if you are sure that PR #93953 is not what caused this issue, do you possibly have an idea what else could cause InvalidCastExceptions in Task.RunContinuations with .NET 9 on iOS (which did not occur with .NET 8)?

That's what we're trying to figure out by surfacing the first exception, but we have been unsuccessful reproducing anything to this point. I do think it's something unique to the iOS runtime in .NET 9.

@janusw
Copy link

janusw commented May 5, 2025

So, if you are sure that PR #93953 is not what caused this issue, do you possibly have an idea what else could cause InvalidCastExceptions in Task.RunContinuations with .NET 9 on iOS (which did not occur with .NET 8)?

That's what we're trying to figure out by surfacing the first exception, but we have been unsuccessful reproducing anything to this point.

Is there anything one can do to help debug this? Due to the ghostly nature of this issue, I think it will be hard to create a reliable reproducer (plus, my app is closed-source). Even worse: It only seems to occur in Release builds.

So, if I manage to hit the exception by chance, what can I do to debug and pinpoint it?

@linnkrb
Copy link

linnkrb commented May 5, 2025

We also have this exact same problem and itΒ΄s driving us mad. All worked well before upgrading to .net9. We have a few background task that updates data every 15 min, some ui related updates every 15 seconds, and after a random number of times it just crashes. Some times it can take a pretty long time, but it feels pretty ransom. The app can be idle except for the background updates.

IΒ΄ll just drop here all our findings and hope someone can get good use of it and figure out how to solve it.

`System.InvalidCastException:
at System.Threading.Tasks.Task.RunContinuations (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.FinishContinuations (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.FinishStageThree (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.FinishStageTwo (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.Finish (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.Task.ExecuteFromThreadPool (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.ThreadPoolWorkQueue.DispatchWorkItem (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.ThreadPoolWorkQueue.Dispatch (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.PortableThreadPool+WorkerThread.WorkerDoWork (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart (System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)

`

Image

`Incident Identifier: 28AD7BBA-770F-46EB-ABC8-8CEF07A29AC5
Distributor ID: com.apple.TestFlight
Hardware Model: iPad16,1
Process: FrontSystems [817]
Path: /private/var/containers/Bundle/Application/935093F6-569C-4A31-96A9-343E5D6A669D/FrontSystems.app/FrontSystems
Identifier: no.frontsystems.cornerstone
Version: 2.0.1 (208)
AppStoreTools: 16E137
AppVariant: 1:iPad16,1:18
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: no.frontsystems.cornerstone [672]

Date/Time: 2025-05-05 19:50:55.9033 +0200
Launch Time: 2025-05-05 19:50:43.5463 +0200
OS Version: iPhone OS 18.4.1 (22E252)
Release Type: User
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: FrontSystems [817]

Triggered by Thread: 20

Thread 0 name:
Thread 0 name:
Thread 0:
0 libsystem_kernel.dylib 0x00000001d91ffce4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001d920339c mach_msg2_internal + 76 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001d92032b8 mach_msg_overwrite + 428 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001d9203100 mach_msg + 24 (mach_msg.c:323)
4 CoreFoundation 0x00000001886746cc __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5 CoreFoundation 0x0000000188673dac __CFRunLoopRun + 1208 (CFRunLoop.c:3021)
6 CoreFoundation 0x0000000188698700 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
7 GraphicsServices 0x00000001d51d9190 GSEventRunModal + 168 (GSEvent.c:2196)
8 UIKitCore 0x000000018b2b6240 -[UIApplication _run] + 816 (UIApplication.m:3845)
9 UIKitCore 0x000000018b2b4470 UIApplicationMain + 336 (UIApplication.m:5540)
10 FrontSystems 0x00000001035e84b0 xamarin_UIApplicationMain (in FrontSystems) (bindings.m:131) + 8897712
11 FrontSystems 0x00000001037f918c do_icall (in FrontSystems) (interp.c:2426) + 11063692
12 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
13 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
14 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
15 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
16 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
17 FrontSystems 0x00000001037515d8 mono_runtime_exec_main_checked (in FrontSystems) (object.c:4808) + 10376664
18 FrontSystems 0x00000001037b5b14 mono_jit_exec (in FrontSystems) (driver.c:1311) + 10787604
19 FrontSystems 0x00000001035fcaec xamarin_main (in FrontSystems) (monotouch-main.m:0) + 8981228
20 FrontSystems 0x00000001039b711c main (in FrontSystems) (main.arm64.mm:81) + 12890396
21 dyld 0x00000001af09bad8 start + 5964 (dyldMain.cpp:1443)

Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x00000001036d59b4 thread_func (in FrontSystems) (sgen-thread-pool.c:195) + 9869748
3 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
4 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x00000001d91ffc60 semaphore_wait_trap + 8 (:-1)
1 FrontSystems 0x000000010378b178 finalizer_thread (in FrontSystems) (gc.c:868) + 10613112
2 FrontSystems 0x000000010376417c start_wrapper (in FrontSystems) (threads.c:1276) + 10453372
3 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
4 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 3:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 4:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001d91ffce4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001d920339c mach_msg2_internal + 76 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001d92032b8 mach_msg_overwrite + 428 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001d9203100 mach_msg + 24 (mach_msg.c:323)
4 CoreFoundation 0x00000001886746cc __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5 CoreFoundation 0x0000000188673dac __CFRunLoopRun + 1208 (CFRunLoop.c:3021)
6 CoreFoundation 0x0000000188698700 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
7 Foundation 0x00000001872da8a8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:375)
8 Foundation 0x00000001872d96d8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:422)
9 UIKitCore 0x000000018b3a95ec -[UIEventFetcher threadMain] + 424 (UIEventFetcher.m:1351)
10 Foundation 0x000000018737bcf8 NSThread__start + 732 (NSThread.m:991)
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 6:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae9328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x000000010365e818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 9 name:
Thread 9:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae9328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x000000010365e818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 10 name:
Thread 10:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae9328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x000000010365e818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 11 name:
Thread 11:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae9328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x000000010365e818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 12 name:
Thread 12:
0 libsystem_kernel.dylib 0x00000001d9206768 kevent + 8 (:-1)
1 FrontSystems 0x000000010365c9b4 SystemNative_WaitForSocketEvents (in FrontSystems) (pal_networking.c:3256) + 9374132
2 FrontSystems 0x00000001037f912c do_icall (in FrontSystems) (interp.c:2402) + 11063596
3 FrontSystems 0x00000001037f7760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
4 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
5 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
6 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
7 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
8 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
9 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
10 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 13 name:
Thread 13:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 14 name:
Thread 14:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 15 name:
Thread 15:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 16:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 17:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 18:
0 libsystem_pthread.dylib 0x0000000212ae79f0 start_wqthread + 0 (:-1)

Thread 19 name:
Thread 19:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 20 name:
Thread 20 Crashed:
0 libsystem_kernel.dylib 0x00000001d920a1dc __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212aedb40 pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x000000019063d2d0 abort + 124 (abort.c:122)
3 FrontSystems 0x0000000103a10c24 0x0000000100ca4c24 (in FrontSystems) + 13257764
4 FrontSystems 0x00000001037e86cc mono_runtime_setup_stat_profiler (in FrontSystems) (mini-posix.c:692) + 10995404
5 libsystem_platform.dylib 0x0000000212a3eeec _sigtramp + 56 (sigtramp.c:116)
6 libsystem_pthread.dylib 0x0000000212aedb40 pthread_kill + 268 (pthread.c:1721)
7 libsystem_c.dylib 0x000000019063d2d0 abort + 124 (abort.c:122)
8 FrontSystems 0x00000001035f3148 xamarin_find_protocol_wrapper_type (in FrontSystems) (runtime.m:1218) + 8941896
9 FrontSystems 0x00000001037001c4 mono_invoke_unhandled_exception_hook (in FrontSystems) (exception.c:1263) + 10043844
10 FrontSystems 0x00000001037644bc start_wrapper (in FrontSystems) (threads.c:1276) + 10454204
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 21 name:
Thread 21:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 22 name:
Thread 22:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 23 name:
Thread 23:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 24 name:
Thread 24:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 25 name:
Thread 25:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 26 name:
Thread 26:
0 libsystem_kernel.dylib 0x00000001d9205438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000212ae92fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000103685724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000103689ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x00000001037f9100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x00000001037f7798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x00000001037ec7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x00000001037ea388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001037ae0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010374a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000103764270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x0000000212ae7afc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x0000000212ae7a04 thread_start + 8 (:-1)

Thread 20 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0xffffffff94e56dff x5: 0x0000000000000018 x6: 0x000000016ecfa570 x7: 0x000000016ecf9c60
x8: 0x69477f8af3917d1e x9: 0x69477f8b9d5ecd1e x10: 0x00000000000003ff x11: 0x000000016ecf9cd8
x12: 0x0000000000000000 x13: 0x00000001035cb4b8 x14: 0x0000000000000001 x15: 0x0000000000000001
x16: 0x0000000000000148 x17: 0x000000016ecfb000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000000000be13 x21: 0x000000016ecfb0e0 x22: 0x00000001260d4000 x23: 0x000000016ecfb000
x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x0000000103fa5668 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x000000016ecfa580 lr: 0x0000000212aedb40
sp: 0x000000016ecfa560 pc: 0x00000001d920a1dc cpsr: 0x40001000
esr: 0x56000080 Address size fault

Binary Images:
0x102d6c000 - 0x103bdbfff FrontSystems arm64 /var/containers/Bundle/Application/935093F6-569C-4A31-96A9-343E5D6A669D/FrontSystems.app/FrontSystems
0x104064000 - 0x1041abfff libHarfBuzzSharp arm64 <8ca693a9d0533072850919c5df43d67e> /private/var/containers/Bundle/Application/935093F6-569C-4A31-96A9-343E5D6A669D/FrontSystems.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
0x1043bc000 - 0x10491bfff libSkiaSharp arm64 <6b45b7dee11f31139b1f1aff7553de02> /private/var/containers/Bundle/Application/935093F6-569C-4A31-96A9-343E5D6A669D/FrontSystems.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
0x10ae08000 - 0x10ae13fff libobjc-trampolines.dylib arm64e <7b2292ed23143e4f929b2831fc172b43> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x187266000 - 0x187eef5ff Foundation arm64e <2bd7eb532f573300b8de478229e49115> /System/Library/Frameworks/Foundation.framework/Foundation
0x188603000 - 0x188b7ffff CoreFoundation arm64e <0551baa3c6e93423b0e2be69719c1d7f> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x18aeec000 - 0x18ce2ca1f UIKitCore arm64e <05197341f99832e5a847da98bb8c68bf> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1905c6000 - 0x1906458b7 libsystem_c.dylib arm64e <027de04c2929357bb6a3701405aab6be> /usr/lib/system/libsystem_c.dylib
0x1af08b000 - 0x1af125013 dyld arm64e <189fe4805d5b3b89928958bc88624420> /usr/lib/dyld
0x1d51d8000 - 0x1d51e0c5f GraphicsServices arm64e /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1d91ff000 - 0x1d9238b77 libsystem_kernel.dylib arm64e <9d196db4701331768c025b4c68701c92> /usr/lib/system/libsystem_kernel.dylib
0x212a3b000 - 0x212a42627 libsystem_platform.dylib arm64e <9b52c74387943d229564b6bcf3303389> /usr/lib/system/libsystem_platform.dylib
0x212ae6000 - 0x212af23fb libsystem_pthread.dylib arm64e <00306a1f11183f8690bdd18b5ed5409f> /usr/lib/system/libsystem_pthread.dylib

EOF
GitHub Copilot suggestion:

The crash report indicates that Thread 20 crashed due to an EXC_CRASH (SIGABRT), which is caused by an explicit call to abort(). Below is an analysis of the crash and what can be inferred from the report.

Key Findings from the Crash Report
Crash Cause:

Exception Type: EXC_CRASH (SIGABRT)
Termination Reason: SIGNAL 6 Abort trap: 6
The crash was triggered by an explicit call to abort() in the code.
Triggered by Thread: Thread 20

The crash occurred in mono_runtime_setup_stat_profiler (mini-posix.c:692).
This suggests an issue related to the Mono runtime, possibly involving profiling or exception handling.
Crash Context:

The stack trace shows that the crash occurred in the Mono runtime, specifically in mono_runtime_setup_stat_profiler.
The crash propagated through xamarin_find_protocol_wrapper_type and mono_invoke_unhandled_exception_hook, indicating that an unhandled exception might have occurred.
Stack Trace Highlights:

The crash occurred in the Mono runtime's thread management (start_wrapper in threads.c).
The call to pthread_kill and abort indicates that the process was terminated intentionally due to a critical error.
Thread 20's Role:

Thread 20 appears to be executing application code via the Mono runtime. The crash occurred while handling an unhandled exception or setting up a profiler.
Observations
Unhandled Exception:

The stack trace shows a call to mono_invoke_unhandled_exception_hook, indicating that an unhandled exception occurred in the application.
SIGABRT:

The crash was caused by an explicit call to abort(), likely due to a critical error in the app's logic or runtime environment.
Mono Runtime Involvement:

The involvement of mini-posix.c and runtime.m suggests the issue might be related to the Mono runtime or its interaction with the app.
Next Steps
Symbolicate the Crash Log:

Use the symbolication script to identify the exact function and line number where the crash occurred.
Investigate the Root Cause:

Check for unhandled exceptions or invalid states in the identified function.
Review the logic around mono_runtime_setup_stat_profiler and mono_invoke_unhandled_exception_hook.
Review Mono Runtime Configuration:

Ensure the Mono runtime is properly configured and up to date.
Check for any custom configurations or modifications that might affect its behavior.
Test in Debug Mode:

Run the app in debug mode with additional logging enabled to capture more details about the crash.
Enable Debug Symbols for Production:

If necessary, enable true for production builds to get more detailed stack traces.
Summary
The crash was caused by an unhandled exception or critical error in the Mono runtime, leading to an explicit call to abort(). The issue likely involves the Mono runtime's thread management or exception handling. Further investigation is needed to pinpoint the root cause.

Let me know if you need help interpreting the symbolicated output or further investigating the crash!

@linnkrb
Copy link

linnkrb commented May 5, 2025

We facing with the same problem. The app crashes randomly with Arg_InvalidCastException exception with the same stack as provided above. We just moved the app from Xamarin forms to MAUI9 and facing with this issue on release builds only. I was not able to reproduce it locally. The app periodically syncing data with the backend by making 14 http requests at the same time and updating data in the local sqlite database. To work with database we use sqlite-net-pcl 1.9.172. According to Sentry breadcrumbs and the app logs, the crash always happening somewhere in the end of the sync iteration, but this happening not that often, usually it's finishing without any issues. I assume that this is somehow related to running multiple tasks in parallel or waiting them using Task.WhenAll. We were facing the issue when using MAUI 9.0.50(workload version is 9.0.14/9.0.100). Today we updated MAUI to 9.0.60 and testing. I will update if it helps.

This looks very much like our setup

@steveisok
Copy link
Member

Is there anything one can do to help debug this? Due to the ghostly nature of this issue, I think it will be hard to create a reliable reproducer (plus, my app is closed-source). Even worse: It only seems to occur in Release builds.

So, if I manage to hit the exception by chance, what can I do to debug and pinpoint it?

If you are up for it, can you use this runtime pack built from a fork of our public 9.0 runtime branch?

All you have to do within your project is add a nuget.config if you don't have one and add a local feed. We think this will surface an exception unique to iOS and may help us pinpoint the issue.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="LocalRuntime" value="<path-to-package-dir-goes-here>" />
    <add key="nuget.org"      value="https://api.nuget.org/v3/index.json" />
  </packageSources>

  <packageSourceMapping>
    <packageSource key="LocalRuntime">
      <package pattern="Microsoft.NETCore.App.Runtime.Mono.ios-arm64" />
      <package pattern="Microsoft.NETCore.App.Ref" />
    </packageSource>
    <packageSource key="nuget.org">
      <package pattern="*" />
    </packageSource>
  </packageSourceMapping>
</configuration>

Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

@janusw
Copy link

janusw commented May 6, 2025

Is there anything one can do to help debug this? Due to the ghostly nature of this issue, I think it will be hard to create a reliable reproducer (plus, my app is closed-source). Even worse: It only seems to occur in Release builds.
So, if I manage to hit the exception by chance, what can I do to debug and pinpoint it?

If you are up for it, can you use this runtime pack built from a fork of our public 9.0 runtime branch?

All you have to do within your project is add a nuget.config if you don't have one and add a local feed. We think this will surface an exception unique to iOS and may help us pinpoint the issue.

Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

Awesome, thanks for that nupkg! I hope that I'll be able to try it in the next days. πŸ‘
(My project has a nuget.config already, and I have been working with local package sources in the past.)

@janusw
Copy link

janusw commented May 6, 2025

If you are up for it, can you use this runtime pack built from a fork of our public 9.0 runtime branch?

All you have to do within your project is add a nuget.config if you don't have one and add a local feed. We think this will surface an exception unique to iOS and may help us pinpoint the issue.

Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

@steveisok I just tried to include this nupkg into my app. In addition to your nuget.config snippet, I had to add an explicit package reference in my csproj, in order to have it picked up:

    <PackageReference Include="Microsoft.NETCore.App.Runtime.Mono.ios-arm64" Version="9.0.5" />

But then dotnet restore gives me errors like this:

error NU1213: The package Microsoft.NETCore.App.Runtime.Mono.ios-arm64 9.0.5 has a package type DotnetPlatform that is incompatible with this project. 

@steveisok Could you tell me what this error means and how to get rid of it?

My project is a MAUI app with TFMs like net9.0-android and net9.0-ios and I'm using .NET SDK 9.0.203 on MacOS.

@linnkrb
Copy link

linnkrb commented May 6, 2025

IΒ΄m not 100% sure if we got it included correct, but delete all in my previously downloded nugets in the nuget folders to start fresh, so I do belive it worked.
And i think the error have now changed, but do not get any exception. We do have other crashes, but this is the one we got the most times and i think the other exceptions we now have is not related to this

0 FrontSystems 0x0000000105741af4 mono_interp_exec_method (in FrontSystems) (interp.c:6193) + 11033332
1 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
2 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
3 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
4 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
5 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
6 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Full crash report

`Incident Identifier: BB647D5A-72AD-461C-9DB7-16E91D4E882A
Distributor ID: com.apple.TestFlight
Hardware Model: iPad7,11
Process: FrontSystems [25079]
Path: /private/var/containers/Bundle/Application/32F28AF7-CA3A-458C-B230-057620B8282B/FrontSystems.app/FrontSystems
Identifier: no.frontsystems.cornerstone
Version: 2.0.1 (211)
AppStoreTools: 16E137
AppVariant: 1:iPad7,11:18
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: no.frontsystems.cornerstone [665]

Date/Time: 2025-05-06 13:25:22.6009 +0200
Launch Time: 2025-05-06 12:12:53.5000 +0200
OS Version: iPhone OS 18.4.1 (22E252)
Release Type: User
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000019
Exception Codes: 0x0000000000000001, 0x0000000100000019
VM Region Info: 0x100000019 is not in any region. Bytes before following region: 80461799
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 104cbc000-105904000 [ 12.3M] r-x/r-x SM=COW /var/containers/Bundle/Application/32F28AF7-CA3A-458C-B230-057620B8282B/FrontSystems.app/FrontSystems
Triggered by Thread: 11

Thread 0 name:
Thread 0 name:
Thread 0:
0 libsystem_kernel.dylib 0x00000001dad29bf4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001dad2d17c mach_msg2_internal + 72 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001dad2d0d0 mach_msg_overwrite + 424 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001dad2cf1c mach_msg + 20 (mach_msg.c:323)
4 CoreFoundation 0x0000000190079b30 __CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2637)
5 CoreFoundation 0x00000001900791fc __CFRunLoopRun + 1192 (CFRunLoop.c:3021)
6 CoreFoundation 0x000000019009c57c CFRunLoopRunSpecific + 536 (CFRunLoop.c:3434)
7 GraphicsServices 0x00000001d706000c GSEventRunModal + 164 (GSEvent.c:2196)
8 UIKitCore 0x0000000192a9331c -[UIApplication _run] + 796 (UIApplication.m:3845)
9 UIKitCore 0x0000000192a91654 UIApplicationMain + 308 (UIApplication.m:5540)
10 FrontSystems 0x00000001055384b0 xamarin_UIApplicationMain (in FrontSystems) (bindings.m:131) + 8897712
11 FrontSystems 0x000000010574918c do_icall (in FrontSystems) (interp.c:2426) + 11063692
12 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
13 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
14 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
15 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
16 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
17 FrontSystems 0x00000001056a15d8 mono_runtime_exec_main_checked (in FrontSystems) (object.c:4808) + 10376664
18 FrontSystems 0x0000000105705b14 mono_jit_exec (in FrontSystems) (driver.c:1311) + 10787604
19 FrontSystems 0x000000010554caec xamarin_main (in FrontSystems) (monotouch-main.m:0) + 8981228
20 FrontSystems 0x000000010590711c main (in FrontSystems) (main.arm64.mm:81) + 12890396
21 dyld 0x00000001b43e0318 start + 2492 (dyldMain.cpp:1443)

Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a14 _pthread_cond_wait$VARIANT$mp + 1004 (pthread_cond.c:862)
2 FrontSystems 0x00000001056259b4 thread_func (in FrontSystems) (sgen-thread-pool.c:195) + 9869748
3 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
4 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x00000001dad29b70 semaphore_wait_trap + 8 (:-1)
1 FrontSystems 0x00000001056db178 finalizer_thread (in FrontSystems) (gc.c:868) + 10613112
2 FrontSystems 0x00000001056b417c start_wrapper (in FrontSystems) (threads.c:1276) + 10453372
3 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
4 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 3 name:
Thread 3:
0 libsystem_kernel.dylib 0x00000001dad29bf4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001dad2d17c mach_msg2_internal + 72 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001dad2d0d0 mach_msg_overwrite + 424 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001dad2cf1c mach_msg + 20 (mach_msg.c:323)
4 CoreFoundation 0x0000000190079b30 __CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2637)
5 CoreFoundation 0x00000001900791fc __CFRunLoopRun + 1192 (CFRunLoop.c:3021)
6 CoreFoundation 0x000000019009c57c CFRunLoopRunSpecific + 536 (CFRunLoop.c:3434)
7 Foundation 0x000000018ede0fe4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 (NSRunLoop.m:375)
8 Foundation 0x000000018eddff4c -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 (NSRunLoop.m:422)
9 UIKitCore 0x0000000192b7a300 -[UIEventFetcher threadMain] + 412 (UIEventFetcher.m:1351)
10 Foundation 0x000000018ee7783c NSThread__start + 716 (NSThread.m:991)
11 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a40 _pthread_cond_wait$VARIANT$mp + 1048 (pthread_cond.c:862)
2 FrontSystems 0x00000001055ae818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a40 _pthread_cond_wait$VARIANT$mp + 1048 (pthread_cond.c:862)
2 FrontSystems 0x00000001055ae818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a40 _pthread_cond_wait$VARIANT$mp + 1048 (pthread_cond.c:862)
2 FrontSystems 0x00000001055ae818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a40 _pthread_cond_wait$VARIANT$mp + 1048 (pthread_cond.c:862)
2 FrontSystems 0x00000001055ae818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0 libsystem_kernel.dylib 0x00000001dad3010c kevent + 8
1 FrontSystems 0x00000001055ac9b4 SystemNative_WaitForSocketEvents (in FrontSystems) (pal_networking.c:3256) + 9374132
2 FrontSystems 0x000000010574912c do_icall (in FrontSystems) (interp.c:2402) + 11063596
3 FrontSystems 0x0000000105747760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
4 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
5 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
6 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
7 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
8 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
9 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
10 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 9:
0 libsystem_pthread.dylib 0x00000001eddaa838 start_wqthread + 0 (:-1)

Thread 10 name:
Thread 10:
0 FrontSystems 0x000000010573cb24 mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012900
1 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
2 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
3 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
4 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
5 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
6 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 11 name:
Thread 11 Crashed:
0 FrontSystems 0x0000000105741af4 mono_interp_exec_method (in FrontSystems) (interp.c:6193) + 11033332
1 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
2 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
3 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
4 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
5 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
6 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 12 name:
Thread 12:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a14 _pthread_cond_wait$VARIANT$mp + 1004 (pthread_cond.c:862)
2 FrontSystems 0x00000001055d5724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x00000001055d9ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000105747798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 13:
0 libsystem_pthread.dylib 0x00000001eddaa838 start_wqthread + 0 (:-1)

Thread 14 name:
Thread 14:
0 libsystem_kernel.dylib 0x00000001dad2efd8 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001eddb0a14 _pthread_cond_wait$VARIANT$mp + 1004 (pthread_cond.c:862)
2 FrontSystems 0x00000001055d5724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x00000001055d9ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000105749100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000105747798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x000000010573c7bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x000000010573a388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x00000001056fe0f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x000000010569a3f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x00000001056b4270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x00000001eddaa924 _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001eddaa84c thread_start + 8 (:-1)

Thread 11 crashed with ARM Thread State (64-bit):
x0: 0x0000000303fdc1c8 x1: 0x000000016c6d5fd0 x2: 0x0000000100000001 x3: 0x00000001055e7834
x4: 0x0000000105653f50 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x000000016c6d68c4
x8: 0x0000000100000001 x9: 0x0000000000000018 x10: 0x000000016c6d5fa0 x11: 0x0000000105b54ec0
x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x00000000ffffffff x15: 0x000000000000009e
x16: 0x00000001edd00cc0 x17: 0x0000000000000001 x18: 0x0000000000000000 x19: 0x0000000129b81250
x20: 0x0000000303fdc1c8 x21: 0x000000016c6d5fa0 x22: 0x0000000000000000 x23: 0x000000011e26c8d0
x24: 0x0000000303fdc1c8 x25: 0x000000000000001b x26: 0x0000000105b54ec0 x27: 0x0000000303fdc180
x28: 0x0000000000000000 fp: 0x000000016c6d69d0 lr: 0x0000000105741f0c
sp: 0x000000016c6d4650 pc: 0x0000000105741af4 cpsr: 0x80000000
esr: 0x56000080 Address size fault

Binary Images:
0x104cbc000 - 0x105b2bfff FrontSystems arm64 <0e5ad6da9648315c901a2fa3253e7f19> /var/containers/Bundle/Application/32F28AF7-CA3A-458C-B230-057620B8282B/FrontSystems.app/FrontSystems
0x10625c000 - 0x1063a3fff libHarfBuzzSharp arm64 <8ca693a9d0533072850919c5df43d67e> /private/var/containers/Bundle/Application/32F28AF7-CA3A-458C-B230-057620B8282B/FrontSystems.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
0x106990000 - 0x106eeffff libSkiaSharp arm64 <6b45b7dee11f31139b1f1aff7553de02> /private/var/containers/Bundle/Application/32F28AF7-CA3A-458C-B230-057620B8282B/FrontSystems.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
0x10b420000 - 0x10b42bfff libobjc-trampolines.dylib arm64 /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x18ed73000 - 0x18f93581f Foundation arm64 /System/Library/Frameworks/Foundation.framework/Foundation
0x190009000 - 0x190576fff CoreFoundation arm64 <23ef691cc62f32d4a78d05ac9c7beaba> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1926fe000 - 0x1944abf3f UIKitCore arm64 <115ab21b23ad3c5292fc921d6789a43d> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1b43d3000 - 0x1b4455a47 dyld arm64 /usr/lib/dyld
0x1d705f000 - 0x1d70674df GraphicsServices arm64 <08dbb058dbdf3c748eac0e015d869a30> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1dad29000 - 0x1dad6054f libsystem_kernel.dylib arm64 /usr/lib/system/libsystem_kernel.dylib
0x1edcff000 - 0x1edd0abcf libsystem_platform.dylib arm64 /usr/lib/system/libsystem_platform.dylib
0x1edda9000 - 0x1eddb93ef libsystem_pthread.dylib arm64 <7d06e933a40131cdacf97e7055c4f4f1> /usr/lib/system/libsystem_pthread.dylib

EOF
`

@linnkrb
Copy link

linnkrb commented May 6, 2025

Or maybe not, this is the other crash report we get, maybe this is the one related...
`Incident Identifier: 99F56DCA-301C-49B9-9758-E61E8FA4E55E
Distributor ID: com.apple.TestFlight
Hardware Model: iPhone15,4
Process: FrontSystems [1212]
Path: /private/var/containers/Bundle/Application/D3850A45-2902-483A-82EB-CA0569E57DBB/FrontSystems.app/FrontSystems
Identifier: no.frontsystems.cornerstone
Version: 2.0.1 (211)
AppStoreTools: 16E137
AppVariant: 1:iPhone15,4:18
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: no.frontsystems.cornerstone [752]

Date/Time: 2025-05-06 13:26:37.5899 +0200
Launch Time: 2025-05-06 13:26:14.0689 +0200
OS Version: iPhone OS 18.4.1 (22E252)
Release Type: User
Baseband Version: 2.52.03
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: FrontSystems [1212]

Triggered by Thread: 23

Thread 0 name:
Thread 0 name:
Thread 0:
0 FrontSystems 0x0000000104d3dc8c mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11050124
1 FrontSystems 0x0000000104d31b84 interp_entry_from_trampoline (in FrontSystems) (interp.c:3229) + 11000708
2 FrontSystems 0x0000000104b19970 native_to_interp_trampoline (in FrontSystems) + 112 + 8804720
3 UIKitCore 0x0000000193ac72c8 -[UIAlertController _invokeHandlersForAction:] + 88 (UIAlertController.m:1218)
4 UIKitCore 0x0000000193ac7af8 __103-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:dismissCompletion:]_block_invoke_2 + 36 (UIAlertController.m:1383)
5 UIKitCore 0x00000001933925fc -[UIPresentationController transitionDidFinish:] + 840 (UIPresentationController.m:677)
6 UIKitCore 0x00000001936e60d8 __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke.112 + 344 (UIPresentationController.m:1423)
7 UIKitCore 0x0000000193420774 -[_UIViewControllerTransitionContext completeTransition:] + 192 (UIViewControllerTransitioning.m:353)
8 UIKitCore 0x0000000193303c54 UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK + 36 (UIView.m:16568)
9 UIKitCore 0x0000000193303ae4 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 628 (UIView.m:16601)
10 UIKitCore 0x00000001933027a4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436 (UIView.m:0)
11 UIKitCore 0x0000000193303d1c -[UIViewAnimationState animationDidStop:finished:] + 192 (UIView.m:2417)
12 UIKitCore 0x0000000193303d8c -[UIViewAnimationState animationDidStop:finished:] + 304 (UIView.m:2439)
13 QuartzCore 0x000000019254dbac run_animation_callbacks(void*) + 132 (CALayer.mm:7843)
14 libdispatch.dylib 0x00000001988d3584 _dispatch_client_callout + 16 (client_callout.mm:85)
15 libdispatch.dylib 0x00000001988f0574 _dispatch_main_queue_drain.cold.5 + 812 (queue.c:8104)
16 libdispatch.dylib 0x00000001988c8d30 _dispatch_main_queue_drain + 180 (queue.c:8085)
17 libdispatch.dylib 0x00000001988c8c6c _dispatch_main_queue_callback_4CF + 44 (queue.c:8264)
18 CoreFoundation 0x00000001909ae2b4 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 (CFRunLoop.c:1793)
19 CoreFoundation 0x00000001909ac0b0 __CFRunLoopRun + 1980 (CFRunLoop.c:3163)
20 CoreFoundation 0x00000001909d0700 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
21 GraphicsServices 0x00000001dd511190 GSEventRunModal + 168 (GSEvent.c:2196)
22 UIKitCore 0x00000001935ee240 -[UIApplication _run] + 816 (UIApplication.m:3845)
23 UIKitCore 0x00000001935ec470 UIApplicationMain + 336 (UIApplication.m:5540)
24 FrontSystems 0x0000000104b304b0 xamarin_UIApplicationMain (in FrontSystems) (bindings.m:131) + 8897712
25 FrontSystems 0x0000000104d4118c do_icall (in FrontSystems) (interp.c:2426) + 11063692
26 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
27 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
28 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
29 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
30 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
31 FrontSystems 0x0000000104c995d8 mono_runtime_exec_main_checked (in FrontSystems) (object.c:4808) + 10376664
32 FrontSystems 0x0000000104cfdb14 mono_jit_exec (in FrontSystems) (driver.c:1311) + 10787604
33 FrontSystems 0x0000000104b44aec xamarin_main (in FrontSystems) (monotouch-main.m:0) + 8981228
34 FrontSystems 0x0000000104eff11c main (in FrontSystems) (main.arm64.mm:81) + 12890396
35 dyld 0x00000001b73d3ad8 start + 5964 (dyldMain.cpp:1443)

Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104c1d9b4 thread_func (in FrontSystems) (sgen-thread-pool.c:195) + 9869748
3 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
4 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x00000001e1537c60 semaphore_wait_trap + 8 (:-1)
1 FrontSystems 0x0000000104cd3178 finalizer_thread (in FrontSystems) (gc.c:868) + 10613112
2 FrontSystems 0x0000000104cac17c start_wrapper (in FrontSystems) (threads.c:1276) + 10453372
3 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
4 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 3:
0 libsystem_pthread.dylib 0x000000021aeba9f0 start_wqthread + 0 (:-1)

Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x00000001e1537ce4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001e153b39c mach_msg2_internal + 76 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001e153b2b8 mach_msg_overwrite + 428 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001e153b100 mach_msg + 24 (mach_msg.c:323)
4 CoreFoundation 0x00000001909ac6cc __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)
5 CoreFoundation 0x00000001909abdac __CFRunLoopRun + 1208 (CFRunLoop.c:3021)
6 CoreFoundation 0x00000001909d0700 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
7 Foundation 0x000000018f6128a8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:375)
8 Foundation 0x000000018f6116d8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:422)
9 UIKitCore 0x00000001936e15ec -[UIEventFetcher threadMain] + 424 (UIEventFetcher.m:1351)
10 Foundation 0x000000018f6b3cf8 NSThread__start + 732 (NSThread.m:991)
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x0000000104ba6818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x0000000104ba6818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x0000000104ba6818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 9 name:
Thread 9:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc328 _pthread_cond_wait + 1028 (pthread_cond.c:862)
2 FrontSystems 0x0000000104ba6818 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9381912
3 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
4 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
5 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
6 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
7 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
8 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
9 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
10 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
11 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 10 name:
Thread 10:
0 libsystem_kernel.dylib 0x00000001e153e768 kevent + 8 (:-1)
1 FrontSystems 0x0000000104ba49b4 SystemNative_WaitForSocketEvents (in FrontSystems) (pal_networking.c:3256) + 9374132
2 FrontSystems 0x0000000104d4112c do_icall (in FrontSystems) (interp.c:2402) + 11063596
3 FrontSystems 0x0000000104d3f760 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 11056992
4 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
5 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
6 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
7 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
8 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
9 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
10 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 11 name:
Thread 11:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 12 name:
Thread 12:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 13:
0 libsystem_pthread.dylib 0x000000021aeba9f0 start_wqthread + 0 (:-1)

Thread 14 name:
Thread 14:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 15:
0 libsystem_pthread.dylib 0x000000021aeba9f0 start_wqthread + 0 (:-1)

Thread 16:
0 libsystem_pthread.dylib 0x000000021aeba9f0 start_wqthread + 0 (:-1)

Thread 17:
0 libsystem_pthread.dylib 0x000000021aeba9f0 start_wqthread + 0 (:-1)

Thread 18 name:
Thread 18:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 19 name:
Thread 19:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 20 name:
Thread 20:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 21 name:
Thread 21:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 22 name:
Thread 22:
0 libsystem_kernel.dylib 0x00000001e153d438 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aebc2fc _pthread_cond_wait + 984 (pthread_cond.c:862)
2 FrontSystems 0x0000000104bcd724 mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9541412
3 FrontSystems 0x0000000104bd1ae0 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9558752
4 FrontSystems 0x0000000104d41100 do_icall (in FrontSystems) (interp.c:2390) + 11063552
5 FrontSystems 0x0000000104d3f798 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 11057048
6 FrontSystems 0x0000000104d347bc mono_interp_exec_method (in FrontSystems) (interp.c:0) + 11012028
7 FrontSystems 0x0000000104d32388 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 11002760
8 FrontSystems 0x0000000104cf60f8 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:3686) + 10756344
9 FrontSystems 0x0000000104c923f8 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10347512
10 FrontSystems 0x0000000104cac270 start_wrapper (in FrontSystems) (threads.c:1276) + 10453616
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 23 name:
Thread 23 Crashed:
0 libsystem_kernel.dylib 0x00000001e15421dc __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x000000021aec0b40 pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x00000001989752d0 abort + 124 (abort.c:122)
3 FrontSystems 0x0000000104f58c24 0x0000000100ca4c24 (in FrontSystems) + 13257764
4 FrontSystems 0x0000000104d306cc mono_runtime_setup_stat_profiler (in FrontSystems) (mini-posix.c:692) + 10995404
5 libsystem_platform.dylib 0x000000021ae11eec _sigtramp + 56 (sigtramp.c:116)
6 libsystem_pthread.dylib 0x000000021aec0b40 pthread_kill + 268 (pthread.c:1721)
7 libsystem_c.dylib 0x00000001989752d0 abort + 124 (abort.c:122)
8 FrontSystems 0x0000000104b3b148 xamarin_find_protocol_wrapper_type (in FrontSystems) (runtime.m:1218) + 8941896
9 FrontSystems 0x0000000104c481c4 mono_invoke_unhandled_exception_hook (in FrontSystems) (exception.c:1263) + 10043844
10 FrontSystems 0x0000000104cac4bc start_wrapper (in FrontSystems) (threads.c:1276) + 10454204
11 libsystem_pthread.dylib 0x000000021aebaafc _pthread_start + 136 (pthread.c:931)
12 libsystem_pthread.dylib 0x000000021aebaa04 thread_start + 8 (:-1)

Thread 23 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0xffffffff9704edff x5: 0x0000000000000018 x6: 0x000000016e04a570 x7: 0x000000016e049c60
x8: 0xf254d7953f683b94 x9: 0xf254d794516c8b94 x10: 0x00000000000003ff x11: 0x000000016e049cd8
x12: 0x0000000000000000 x13: 0x0000000104b134b8 x14: 0x0000000000000001 x15: 0x0000000000000001
x16: 0x0000000000000148 x17: 0x000000016e04b000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000000011607 x21: 0x000000016e04b0e0 x22: 0x00000001270c4000 x23: 0x000000016e04b000
x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x00000001054ed668 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x000000016e04a580 lr: 0x000000021aec0b40
sp: 0x000000016e04a560 pc: 0x00000001e15421dc cpsr: 0x40001000
esr: 0x56000080 Address size fault

Binary Images:
0x1042b4000 - 0x105123fff FrontSystems arm64 <0e5ad6da9648315c901a2fa3253e7f19> /var/containers/Bundle/Application/D3850A45-2902-483A-82EB-CA0569E57DBB/FrontSystems.app/FrontSystems
0x105838000 - 0x10597ffff libHarfBuzzSharp arm64 <8ca693a9d0533072850919c5df43d67e> /private/var/containers/Bundle/Application/D3850A45-2902-483A-82EB-CA0569E57DBB/FrontSystems.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
0x105f6c000 - 0x1064cbfff libSkiaSharp arm64 <6b45b7dee11f31139b1f1aff7553de02> /private/var/containers/Bundle/Application/D3850A45-2902-483A-82EB-CA0569E57DBB/FrontSystems.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
0x10c330000 - 0x10c33bfff libobjc-trampolines.dylib arm64e <7b2292ed23143e4f929b2831fc172b43> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x18f59e000 - 0x1902275ff Foundation arm64e <2bd7eb532f573300b8de478229e49115> /System/Library/Frameworks/Foundation.framework/Foundation
0x19093b000 - 0x190eb7fff CoreFoundation arm64e <0551baa3c6e93423b0e2be69719c1d7f> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1924b1000 - 0x19286b45f QuartzCore arm64e /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x193224000 - 0x195164a1f UIKitCore arm64e <05197341f99832e5a847da98bb8c68bf> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1988b8000 - 0x1988fdaff libdispatch.dylib arm64e <2c7db97b46f03a67af9fe26859f0008d> /usr/lib/system/libdispatch.dylib
0x1988fe000 - 0x19897d8b7 libsystem_c.dylib arm64e <027de04c2929357bb6a3701405aab6be> /usr/lib/system/libsystem_c.dylib
0x1b73c3000 - 0x1b745d013 dyld arm64e <189fe4805d5b3b89928958bc88624420> /usr/lib/dyld
0x1dd510000 - 0x1dd518c5f GraphicsServices arm64e /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1e1537000 - 0x1e1570b77 libsystem_kernel.dylib arm64e <9d196db4701331768c025b4c68701c92> /usr/lib/system/libsystem_kernel.dylib
0x21ae0e000 - 0x21ae15627 libsystem_platform.dylib arm64e <9b52c74387943d229564b6bcf3303389> /usr/lib/system/libsystem_platform.dylib
0x21aeb9000 - 0x21aec53fb libsystem_pthread.dylib arm64e <00306a1f11183f8690bdd18b5ed5409f> /usr/lib/system/libsystem_pthread.dylib

EOF
`

@kotlarmilos
Copy link
Member

kotlarmilos commented May 6, 2025

If you are up for it, can you use this runtime pack built from a fork of our public 9.0 runtime branch?
All you have to do within your project is add a nuget.config if you don't have one and add a local feed. We think this will surface an exception unique to iOS and may help us pinpoint the issue.
Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

@steveisok I just tried to include this nupkg into my app. In addition to your nuget.config snippet, I had to add an explicit package reference in my csproj, in order to have it picked up:

    <PackageReference Include="Microsoft.NETCore.App.Runtime.Mono.ios-arm64" Version="9.0.5" />

But then dotnet restore gives me errors like this:

error NU1213: The package Microsoft.NETCore.App.Runtime.Mono.ios-arm64 9.0.5 has a package type DotnetPlatform that is incompatible with this project. 

@steveisok Could you tell me what this error means and how to get rid of it?

My project is a MAUI app with TFMs like net9.0-android and net9.0-ios and I'm using .NET SDK 9.0.203 on MacOS.

@janusw Try to add the following instead of the PackageReference version:

<ItemGroup>
	<FrameworkReference Update="Microsoft.NETCore.App">
		<RuntimeFrameworkVersion>9.0.5</RuntimeFrameworkVersion>
	</FrameworkReference>
</ItemGroup>

Ensure you have the provided nuget.config, and clear cache by running dotnet nuget locals --clear all.

Microsoft.NETCore.App.Ref.9.0.5.nupkg.zip
Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

@kotlarmilos
Copy link
Member

kotlarmilos commented May 6, 2025

IΒ΄m not 100% sure if we got it included correct, but delete all in my previously downloded nugets in the nuget folders to start fresh, so I do belive it worked.
And i think the error have now changed, but do not get any exception. We do have other crashes, but this is the one we got the most times and i think the other exceptions we now have is not related to this

@linnkrb With the patch applied, we expect it to throw a different managed exception, which will help us determine the root cause of the failure. Did you get any managed exception trace related to threading (but not the invalid cast, which should be already addressed in the provided NuGet packages)?

@janusw
Copy link

janusw commented May 6, 2025

@janusw Try to add the following instead of the PackageReference version:

<ItemGroup>
	<FrameworkReference Update="Microsoft.NETCore.App">
		<RuntimeFrameworkVersion>9.0.5</RuntimeFrameworkVersion>
	</FrameworkReference>
</ItemGroup>

Ensure you have the provided nuget.config, and clear cache by running dotnet nuget locals --clear all.

Microsoft.NETCore.App.Ref.9.0.5.nupkg.zip Microsoft.NETCore.App.Runtime.Mono.ios-arm64.9.0.5.nupkg.zip

Thanks for the hints, @kotlarmilos. With this I can build, but the results are the same as before. I still see SIGABRT: Specified cast is not valid with the stack trace shown in the original report.

So either your modifications have no influence on the observed behavior, or the nupkgs are still not picked up properly. I actually expected my packages.lock.json file to reflect the modified version of Microsoft.NETCore.App.Runtime.Mono, but it doesn't. (Should it?)

@kotlarmilos Can you recommend a simple way to verify that my build uses the nupkgs you provided?

@janusw
Copy link

janusw commented May 6, 2025

Ok, sorry, I think I made a mistake, which caused the nupkgs not to be used. I fixed it, then saw errors like:

error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.Mono.android-arm with version (= 9.0.5)

I fixed that by removing the Android TFM, and only keeping iOS. I'm about to rebuild and retry ...

@linnkrb
Copy link

linnkrb commented May 6, 2025

I fixed that by removing the Android TFM, and only keeping iOS. I'm about to rebuild and retry ...

We got the same, but re-build with just adding those pacgages to iOs, and still no luck getting anything that brings more light to the issue. All our crashlogs are now of this, just varies what thread that crashes depending on how long the app has been running

`Incident Identifier: 67DBFC0B-B6EC-4EA9-8894-127D2BD91F80
Distributor ID: com.apple.TestFlight
Hardware Model: iPad7,5
Process: FrontSystems [1790]
Path: /private/var/containers/Bundle/Application/72E38665-57F4-48E3-AE77-D0D5178E71BA/FrontSystems.app/FrontSystems
Identifier: no.frontsystems.cornerstone
Version: 2.0.1 (212)
AppStoreTools: 16E137
AppVariant: 1:iPad7,5:17.4
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: no.frontsystems.cornerstone [447]

Date/Time: 2025-05-06 16:42:54.7979 +0200
Launch Time: 2025-05-06 16:20:04.4101 +0200
OS Version: iPhone OS 17.7.6 (21H423)
Release Type: User
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000019
Exception Codes: 0x0000000000000001, 0x0000000100000019
VM Region Info: 0x100000019 is not in any region. Bytes before following region: 49135591
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102edc000-103b00000 [ 12.1M] r-x/r-x SM=COW /var/containers/Bundle/Application/72E38665-57F4-48E3-AE77-D0D5178E71BA/FrontSystems.app/FrontSystems
Triggered by Thread: 9

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter

Thread 0 name:
Thread 0 name:
Thread 0:
0 libsystem_kernel.dylib 0x00000001eb38bb58 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001eb38f224 mach_msg2_internal + 76 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001eb38f1b0 mach_msg_overwrite + 492 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001eb38efb8 mach_msg + 20 (mach_msg.c:323)
4 CoreFoundation 0x00000001a7a65a6c __CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2624)
5 CoreFoundation 0x00000001a7a650dc __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6 CoreFoundation 0x00000001a7a647d0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3420)
7 GraphicsServices 0x00000001e74d8814 GSEventRunModal + 160 (GSEvent.c:2196)
8 UIKitCore 0x00000001a9f61268 -[UIApplication _run] + 868 (UIApplication.m:3713)
9 UIKitCore 0x00000001aa00b90c UIApplicationMain + 312 (UIApplication.m:5303)
10 FrontSystems 0x00000001037584b0 xamarin_UIApplicationMain (in FrontSystems) (bindings.m:131) + 8897712
11 FrontSystems 0x000000010394ba68 do_icall (in FrontSystems) (interp.c:2426) + 10943080
12 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
13 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
14 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
15 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
16 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
17 FrontSystems 0x00000001038b258c mono_runtime_exec_main_checked (in FrontSystems) (object.c:4808) + 10315148
18 FrontSystems 0x000000010390f6dc mono_jit_exec (in FrontSystems) (driver.c:1311) + 10696412
19 FrontSystems 0x000000010376caec xamarin_main (in FrontSystems) (monotouch-main.m:0) + 8981228
20 FrontSystems 0x0000000103b03768 main (in FrontSystems) (main.arm64.mm:81) + 12744552
21 dyld 0x00000001c8fe7228 start + 1520 (dyldMain.cpp:1298)

Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26afd8 _pthread_cond_wait$VARIANT$mp + 1232 (pthread_cond.c:862)
2 FrontSystems 0x000000010383f5bc thread_func (in FrontSystems) (sgen-thread-pool.c:195) + 9844156
3 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
4 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x00000001eb38bad4 semaphore_wait_trap + 8 (:-1)
1 FrontSystems 0x00000001038e6e78 finalizer_thread (in FrontSystems) (gc.c:868) + 10530424
2 FrontSystems 0x00000001038c2b94 start_wrapper (in FrontSystems) (threads.c:1276) + 10382228
3 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
4 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 3 name:
Thread 3:
0 libsystem_kernel.dylib 0x00000001eb38bb58 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001eb38f224 mach_msg2_internal + 76 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001eb38f1b0 mach_msg_overwrite + 492 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001eb38efb8 mach_msg + 20 (mach_msg.c:323)
4 CoreFoundation 0x00000001a7a65a6c __CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2624)
5 CoreFoundation 0x00000001a7a650dc __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6 CoreFoundation 0x00000001a7a647d0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3420)
7 Foundation 0x00000001a6a7f368 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 (NSRunLoop.m:373)
8 Foundation 0x00000001a6a7f1e4 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 (NSRunLoop.m:420)
9 UIKitCore 0x00000001a9f73e28 -[UIEventFetcher threadMain] + 408 (UIEventFetcher.m:1207)
10 Foundation 0x00000001a6a93d04 NSThread__start + 720 (NSThread.m:991)
11 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26b004 _pthread_cond_wait$VARIANT$mp + 1276 (pthread_cond.c:862)
2 FrontSystems 0x00000001037d0484 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9389188
3 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
4 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
5 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
6 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
7 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
8 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
9 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
10 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26b004 _pthread_cond_wait$VARIANT$mp + 1276 (pthread_cond.c:862)
2 FrontSystems 0x00000001037d0484 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9389188
3 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
4 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
5 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
6 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
7 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
8 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
9 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
10 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26b004 _pthread_cond_wait$VARIANT$mp + 1276 (pthread_cond.c:862)
2 FrontSystems 0x00000001037d0484 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9389188
3 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
4 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
5 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
6 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
7 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
8 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
9 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
10 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26b004 _pthread_cond_wait$VARIANT$mp + 1276 (pthread_cond.c:862)
2 FrontSystems 0x00000001037d0484 SystemNative_LowLevelMonitor_TimedWait (in FrontSystems) (pal_threading.c:198) + 9389188
3 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
4 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
5 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
6 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
7 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
8 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
9 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
10 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
11 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0 libsystem_kernel.dylib 0x00000001eb3923ec kevent + 8 (:-1)
1 FrontSystems 0x00000001037ce5c0 SystemNative_WaitForSocketEvents (in FrontSystems) (pal_networking.c:3256) + 9381312
2 FrontSystems 0x000000010394bae4 do_icall (in FrontSystems) (interp.c:2402) + 10943204
3 FrontSystems 0x000000010394a110 do_icall_wrapper (in FrontSystems) (interp.c:2467) + 10936592
4 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
5 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
6 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
7 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
8 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
9 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
10 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 9 name:
Thread 9 Crashed:
0 FrontSystems 0x0000000103943268 mono_interp_exec_method (in FrontSystems) (interp.c:6221) + 10908264
1 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
2 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
3 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
4 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
5 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
6 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 10:
0 libsystem_pthread.dylib 0x00000001fd263cc4 start_wqthread + 0 (:-1)

Thread 11 name:
Thread 11:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26afd8 _pthread_cond_wait$VARIANT$mp + 1232 (pthread_cond.c:862)
2 FrontSystems 0x00000001037f538c mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9540492
3 FrontSystems 0x00000001037f9158 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9556312
4 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
5 FrontSystems 0x000000010394a148 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 10936648
6 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
7 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
8 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
9 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
10 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
11 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 12:
0 libsystem_pthread.dylib 0x00000001fd263cc4 start_wqthread + 0 (:-1)

Thread 13 name:
Thread 13:
0 libsystem_kernel.dylib 0x00000001eb3911a4 __psynch_cvwait + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fd26afd8 _pthread_cond_wait$VARIANT$mp + 1232 (pthread_cond.c:862)
2 FrontSystems 0x00000001037f538c mono_os_cond_timedwait (in FrontSystems) (mono-os-mutex.c:75) + 9540492
3 FrontSystems 0x00000001037f9158 mono_lifo_semaphore_timed_wait (in FrontSystems) (lifo-semaphore.c:55) + 9556312
4 FrontSystems 0x000000010394bb08 do_icall (in FrontSystems) (interp.c:2390) + 10943240
5 FrontSystems 0x000000010394a148 do_icall_wrapper (in FrontSystems) (interp.c:2473) + 10936648
6 FrontSystems 0x0000000103945250 mono_interp_exec_method (in FrontSystems) (interp.c:4259) + 10916432
7 FrontSystems 0x0000000103940ac8 interp_runtime_invoke (in FrontSystems) (interp.c:2220) + 10898120
8 FrontSystems 0x0000000103908508 mono_jit_runtime_invoke (in FrontSystems) (mini-runtime.c:0) + 10667272
9 FrontSystems 0x00000001038abf00 mono_runtime_invoke_checked (in FrontSystems) (object.c:2788) + 10288896
10 FrontSystems 0x00000001038c2b78 start_wrapper (in FrontSystems) (threads.c:1276) + 10382200
11 libsystem_pthread.dylib 0x00000001fd26782c _pthread_start + 104 (pthread.c:931)
12 libsystem_pthread.dylib 0x00000001fd263cd8 thread_start + 8 (:-1)

Thread 14:
0 libsystem_pthread.dylib 0x00000001fd263cc4 start_wqthread + 0 (:-1)

Thread 15:
0 libsystem_pthread.dylib 0x00000001fd263cc4 start_wqthread + 0 (:-1)

Thread 9 crashed with ARM Thread State (64-bit):
x0: 0x000000011c0f5230 x1: 0x000000011c0f5238 x2: 0x0000000100000001 x3: 0x000000010380594c
x4: 0x000000010386acb4 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x000000016d67e88c
x8: 0x0000000100000001 x9: 0x0000000000000018 x10: 0x00000000000000c0 x11: 0x0000000000000008
x12: 0x0000000000000000 x13: 0x000000012b441aa8 x14: 0x00000000ffffffff x15: 0x00000001260bd820
x16: 0x00000001fd1adb80 x17: 0x0000000000000001 x18: 0x0000000000000000 x19: 0x000000016d67e860
x20: 0x0000000000000010 x21: 0x000000016d67df30 x22: 0x000000000000001b x23: 0x0000000126551178
x24: 0x0000000126551098 x25: 0x000000016d67df30 x26: 0x0000000103d7cf08 x27: 0x0000000301246880
x28: 0x000000011c0f5270 fp: 0x000000016d67e9f0 lr: 0x00000001039474f8
sp: 0x000000016d67bda0 pc: 0x0000000103943268 cpsr: 0x80000000
esr: 0x56000080 Address size fault

Binary Images:
0x102edc000 - 0x103d53fff FrontSystems arm64 /private/var/containers/Bundle/Application/72E38665-57F4-48E3-AE77-D0D5178E71BA/FrontSystems.app/FrontSystems
0x104624000 - 0x10476bfff libHarfBuzzSharp arm64 <8ca693a9d0533072850919c5df43d67e> /private/var/containers/Bundle/Application/72E38665-57F4-48E3-AE77-D0D5178E71BA/FrontSystems.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
0x104788000 - 0x104ce7fff libSkiaSharp arm64 <6b45b7dee11f31139b1f1aff7553de02> /private/var/containers/Bundle/Application/72E38665-57F4-48E3-AE77-D0D5178E71BA/FrontSystems.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
0x109658000 - 0x109663fff libobjc-trampolines.dylib arm64 /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x1a69c4000 - 0x1a746dfff Foundation arm64 <96733d340a373c34810a735d1720ae42> /System/Library/Frameworks/Foundation.framework/Foundation
0x1a7a15000 - 0x1a7f2efff CoreFoundation arm64 /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1a9b8e000 - 0x1ab56cfff UIKitCore arm64 <9c152472929f36f6ba1bb04b81a1a3d4> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1c8fb0000 - 0x1c902f84b dyld arm64 /usr/lib/dyld
0x1e74d7000 - 0x1e74dffff GraphicsServices arm64 /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1eb38a000 - 0x1eb3c1fef libsystem_kernel.dylib arm64 <1abf4f5efe0834368be694b61970defd> /usr/lib/system/libsystem_kernel.dylib
0x1fd1ac000 - 0x1fd1b7ff7 libsystem_platform.dylib arm64 /usr/lib/system/libsystem_platform.dylib
0x1fd263000 - 0x1fd273ffb libsystem_pthread.dylib arm64 <05d0d8cf4b863a7fa70d7006d7925763> /usr/lib/system/libsystem_pthread.dylib
0x1ffe98000 - 0x200661fff ANECompiler arm64 <39ad5a9a2029337e8194b3464ae1c81d> /System/Library/PrivateFrameworks/ANECompiler.framework/ANECompiler

EOF
`

@wgriep
Copy link

wgriep commented May 6, 2025

I have used the fork and was able to get the following running on the iPhone. Hopefully this will help. As a refresher, we are running in a Parallel.ForEachAsync()

TaskScheduler.UnobservedTaskException --> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__292_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

@steveisok
Copy link
Member

I have used the fork and was able to get the following running on the iPhone. Hopefully this will help. As a refresher, we are running in a Parallel.ForEachAsync()

@wgriep and others, I appreciate you all being willing to drink from the firehose ;-). Please keep the info coming if you have it and we'll keep trying to narrow this down.

@janusw
Copy link

janusw commented May 6, 2025

Ok, sorry, I think I made a mistake, which caused the nupkgs not to be used. I fixed it, then saw errors like:

error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.Mono.android-arm with version (= 9.0.5)

I fixed that by removing the Android TFM, and only keeping iOS. I'm about to rebuild and retry ...

Despite longer testing sessions on two different devices, I haven't been able to trigger any more crashes/exceptions with the modified runtime pkgs, which might indicate that these pkgs already fix the problem for our use case, or at least make it even more unlikely than before.

I'll note that our use case is not as massively multi-threaded as the ForEachAsync mentioned by @wgriep. We only have the occasional Task.Run and similar stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests