android: Xamarin Android projects crash on startup after company rolled out ZScaler Client

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.)

Affected platform version

VS 2022 17.3.6

Description

Recently my company pushed out ZScaler to select machines. My machine was one one of them and since the push out the Xamarin Android apps built with Visual Studio now crash on startup.

One of 2 things occurs either the app will throw a null reference exception on startup:

 System.NullReferenceException: Object reference not set to an instance of an object.
      at Java.Interop.Runtime.GetSurfacedObjects () [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Interop/Runtime.cs:14 
      at Android.Runtime.JNIEnv.Exit () [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:210 

Or the app will throw a signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x64696f72646e41

What is weird is if I do a clean all and rebuild, the app will run will run until I change the code. I can add 1 line of code in the OnCreate() of the Main Applicaton class, such as adding something stupid like int h = 0; the app will then crash with either the nullreference error or a seg fault. It crashes before OnCreate is even called.

I had a coworker who does not have ZScaler try the same thing on his machine and his version runs fine (same code base/hardware). If I provide the built APK to my coworker the application will crash on his device

This problem will occur on any Xamarin Android Project I have, so it’s not project specific.

I also determined that if I change Linking: “Sdk Assemblies Only” to “None” then the problem does not occur.

Zscaler messes with the intermediate certificates, I’m not sure how the linker plays into this, but any ideas of how to resolve this would be appreciated.

Version Information:

Microsoft Visual Studio Enterprise 2022
Version 17.3.6
VisualStudio.17.Release/17.3.6+32929.385
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00476-80000-00000-AA479
Microsoft Architecture Diagrams and Analysis Tools

Visual C++ 2022   00476-80000-00000-AA479
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.3.376.3011
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2012   17.3.376.3011
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   17.3.376.3011
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.3.376.3011
Azure Functions and Web Jobs Tools

C# Tools   4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.3.20 (3f4cb00)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.40629.1 Commit Hash:3f5cc0329815af3ffb948f08857446d206a9af36
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62207.04100
Microsoft SQL Server Data Tools

TypeScript Tools   17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.3.0-3.22470.13+80a8ce8d5fdb9ceda4101e2acb8e8eb7be4ebcea
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.3.0.308 (d17-3@56b9f7e)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.3.0.217 (remotes/origin/d17-3@b81db1dcc0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.2.28 (9b3d244)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: dffa5ab
    Java.Interop: xamarin/java.interop/d17-3@7716ae53
    SQLite: xamarin/sqlite/3.38.5@df4deab
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6


Xamarin.iOS and Xamarin.Mac SDK   16.0.0.75 (e4f48bed7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Steps to Reproduce

Create any Xamarin Android Application and have Linking set to “SDK assemblies only” Run it once. Change or add any line of code in the Android project Run it again and it will crash.

Did you find any workaround?

Set linking to “None”

Relevant log output

Build fingerprint: 'Zebra/TC57/TC57:10/10-16-10.00-QG-U120-STD-HEL-04/109:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2022-11-07 13:30:42-0500
pid: 9910, tid: 9910, name: ar.TestApp  >>> TestApp <<<
uid: 10395
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x64696f72646e41
    x0  0000007e6a632540  x1  2e64696f72646e41  x2  0000000000000008  x3  0000007ddc7ce508
    x4  0000000000000000  x5  0000000000000000  x6  0000007d7dabe280  x7  0000007d7dabe300
    x8  0000007ddc7ceda8  x9  0000000000000001  x10 0000000000004001  x11 0000000000000000
    x12 0000000004be3e30  x13 0000000000000001  x14 0000000000000001  x15 0000000000000000
    x16 0000007ddc82d000  x17 0000007e65fe7a48  x18 0000000000000008  x19 0000007fe1718830
    x20 0000007fe1718a30  x21 0000000000000000  x22 0000000000000000  x23 0000007fe1718b98
    x24 0000007e6a6450e0  x25 0000007fe1718b98  x26 0000007ddc7ce508  x27 0000000000000000
    x28 0000007e6a91f020  x29 0000007fe1718790
    sp  0000007fe1718790  lr  0000007d7c3c5dc4  pc  0000007ddc7cef98

backtrace:
      #00 pc 0000000000007f98  <anonymous:7ddc7c7000>

stack:
         0000007fe1718710  0000007d7c6fe000  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe1718718  0000007d7c6fe000  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe1718720  0000007d7c6fe000  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe1718728  0000007d7da847e0  [anon:libc_malloc]
         0000007fe1718730  0000007d7da847e0  [anon:libc_malloc]
         0000007fe1718738  0000007e6a72ca80  [anon:libc_malloc]
         0000007fe1718740  0000007d7daac3a0  [anon:libc_malloc]
         0000007fe1718748  0000007fe1718a30  [stack]
         0000007fe1718750  0000007fe1718820  [stack]
         0000007fe1718758  0000007d7c3c183c  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe1718760  0000007de4caded8  [anon:dalvik-LinearAlloc]
         0000007fe1718768  0000007d7c7172d8  [anon:.bss]
         0000007fe1718770  0000007e6a72ca80  [anon:libc_malloc]
         0000007fe1718778  000000000000000c
         0000007fe1718780  0000007dd4165e15  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonodroid.so
         0000007fe1718788  0000000000000006
    #00  0000007fe1718790  0000007fe17189e0  [stack]
         0000007fe1718798  0000007d7c3c5dc4  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe17187a0  0000007fe1718a30  [stack]
         0000007fe17187a8  0000000000000000
         0000007fe17187b0  0000000000000000
         0000007fe17187b8  0000007fe1718b98  [stack]
         0000007fe17187c0  0000007e6a6450e0  [anon:libc_malloc]
         0000007fe17187c8  0000007d7c6fe000  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe17187d0  0000007e6a607060  [anon:libc_malloc]
         0000007fe17187d8  0000000000000000
         0000007fe17187e0  0000000000000000
         0000007fe17187e8  0000007d7c6fef28  /data/app/TestApp-i7Yz5NO_Jgjg8Mv1hWBLNA==/lib/arm64/libmonosgen-2.0.so
         0000007fe17187f0  0000007ddc82d000
         0000007fe17187f8  0000007fe1718b98  [stack]
         0000007fe1718800  0000000000000000
         0000007fe1718808  0000007e6a72ca80  [anon:libc_malloc]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (13 by maintainers)

Most upvoted comments

@grendello that did not work. I updated to 13.1.99.43 and the problem still occurs.