I have this code which was running fine with Xcode 8 and IOS 10.3.1 till I updated my Xcode to 9 and Visual Studio for Xamarin.
This is the below code which is throwing error and crashing the app during debug:
// Code fetching data from SQLITE [Package name Sqlite-net-pcl]
// Result -> System.Collections.Generic.List
var Result = await _database.GetAsync();
if (Result.Count > 0){
try
{
foreach (var resultObj in Result)
{
Debug.WriteLine("Data {0} ", resultObj.name);
}
}
When I am debugging the code I can see value inside Result and on expression evaluation for resultObj.name I get the desired result. But once the debugger reaches to Debug.WriteLine / If I try to utilize resultObj.name it crashes with the below stack trace :
2017-09-22 15:06:18.549 LoginPage.iOS[415:35914] error: * Assertion at /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/external/mono/mono/mini/debugger-agent.c:4714, condition `array->len == 1' not met
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: Stacktrace:
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: at <unknown> <0xffffffff>
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00007>
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:79
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:63
2017-09-22 15:06:18.552 LoginPage.iOS[415:35914] critical: at LoginPage.iOS.Application.Main (string[]) [0x00001] in /Users/beingsrv/Projects/Prescriber360-App/iOS/Main.cs:19
2017-09-22 15:06:18.552 LoginPage.iOS[415:35914] critical: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <6314851f133e4e74a2e96356deaa0c6c#082A8F72-4318-CDE3-E7A4-8B1E160A93AB>:0
2017-09-22 15:06:18.553 LoginPage.iOS[415:35914] critical:
Native stacktrace:
Also I did tried for loop but facing same issue. It was working correct till I updated my device as well as Visual Studio for IOS 11.
Any Idea ?