Xamarin:条件`array-> len == 1'未遇到SIGABRT错误

时间:2017-09-22 09:46:36

标签: xcode visual-studio xamarin xamarin.ios xamarin.forms

我有这个代码在Xcode 8和IOS 10.3.1上正常运行,直到我将Xcode更新为9和Visual Studio for Xamarin。

以下代码在调试期间抛出错误并导致应用崩溃:

        // 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);
                }
             }

当我调试代码时,我可以看到Result中的值和resultObj.name的表达式求值,我得到了所需的结果。但是一旦调试器到达Debug.WriteLine /如果我尝试使用resultObj.name,它会崩溃并显示下面的堆栈跟踪:

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:

我也尝试过循环,但面临同样的问题。 它正常工作,直到我更新我的设备以及Visual Studio for IOS 11。

任何想法?

0 个答案:

没有答案