I have a .Net MAUI app that uses CommunityToolkit.mvvm.
The following line that checks internet connection is the viewmodel constructor:
_isConnected = Connectivity.NetworkAccess == NetworkAccess.Internet;
It works in Debug mode, but when I run it in Release mode on iOS, it crashes. I wrapped the line in try/catch, but no exception was caught.
Here is the error from the log:
…
“instructionByteStream” : {“beforePC”:”fyMD1f17v6n9AwCRNez/l78DAJH9e8Go/w9f1sADX9YQKYDSARAA1A==”,”atPC”:”AwEAVH8jA9X9e7+p/QMAkSrs/5e/AwCR/XvBqP8PX9bAA1/WECeA0g==”},
” ” : {“codes”:”0x0000000000000000, 0x0000000000000000″,”rawCodes”:[0,0],”type”:”EXC_CRASH”,”signal”:”SIGABRT”},
“ktriageinfo” : “VM – (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enternVM – (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_entern”,
“asi” : {“libsystem_c.dylib”:[“abort() called”]},
“faultingThread” : 0,
…
Any idea why this happens in Release? Maybe there is a better way to check connectivity?