1

I have been stuck with Fatal Signal errors since using Visual Studio 2019 or 2022 to compile my Xamarin Android Project for more than 3 weeks.

I have used ndk-stack and other tools to see any meaningful stack trace I have failed and our project is not going ahead because of this.

Please note that the same exact code base works perfectly stable if I produce an APK using visual Studio 2017.

Visual Studio 2019 uses Xamarin.Andriod.SDK 12.0.0.3

Visual Studio 2017 uses Xamarin.Android.SDK 9.7.1.0

I have attempted to upgrade to Android 12 but our project is Huge and require significant amount of work. It does not seem to be an option at this point.

The reason I want to use 2019 or 2022 is because of google play store and producing app bundle instead of APK. Visual Studio 2017 does not have app bundle option.

My projects target Android 9 and I am also using PortSip Libraries. I have done extensive googling. I have not found any solid evidence if there is a problem with Xamarin Android SKD in 2019 or a problem with my Samsung Device Tab S6. The only answer I found here is: Why application is dying randomly?

If this the case why an APK produced by 2017 does not have any segmentation faults or any race conditions.

I have handlers in c# to catch any error but non of them catches these. My app uses google MAPs and we are drawing many layers and updates on the MAP.

My app also receives many signalr updates and makes calls to WCF services.

Examples of errors:

03-09 19:54:53.811 9984 12254 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40000000080 in tid 12254 (Thread Pool Wor), pid 9984 (------) 03-09 19:54:53.836 12404 12404 E chromium: [0309/195453.835730:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Operation not permitted (1)

03-11 00:35:05.469 27236 27236 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7c13725238

Mustafa
  • 23
  • 3
  • Do you mean that the code on the visual studio 2017 worked well? This error always means that there is a null pointer exception in your project. – Liyun Zhang - MSFT Mar 14 '22 at 06:08
  • Thanks for the reply. The same exact code base still works perfect with visual studio 2017. For example, If I generate an APK using visual studio 2017, my app will run for days and not break. If I use 2019 to generate an APK, the app crashes sometimes within 3 hours or less than 1 min. – Mustafa Mar 15 '22 at 13:36
  • The problem is strange and I can't repeat it. You can report it to the [visual studio developer community](https://developercommunity.visualstudio.com/report?space=8&entry=problem). – Liyun Zhang - MSFT Mar 16 '22 at 06:09

1 Answers1

0

We had a very similar problem with PortSip (null reference exception that was caused by the Garbage Collection thread in PortSip). We found that the problem was in the way a key class PortSip constructor contained mutual references with other classes. When those classes were disposed a null reference exception occurred on the garbage collection thread.

You reported that "I have handlers in C# to catch any error but none of them catches these". We found that to be the case as well. It turned out that since the crash was happening on the CG thread inside the PortSip library - adding error handling in C# had no effect.

If your crashes are also experiencing these symptoms - I will dig into the code and document our fix.