Bug 27403 - Visual Studio throws "NSInternalInconsistencyException Reason: (null)" when debugging an iOS app
Summary: Visual Studio throws "NSInternalInconsistencyException Reason: (null)" when d...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 3.9
Hardware: PC Mac OS
: Normal normal
Target Milestone: 3.9.3
Assignee: mag@xamarin.com
URL:
Depends on:
Blocks:
 
Reported: 2015-02-25 07:46 UTC by Prashant Cholachagudda
Modified: 2016-05-10 17:03 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Prashant Cholachagudda 2015-02-25 07:46:41 UTC
We get MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: (null)
when trying to debug/deploy an iOS app. 

The same code builds on the Xamarin Studio/Mac

## Error message:
2015-02-11 11:26:37.121 AppName[1188:32514] *** -[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?
Unhandled Exception:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: (null)

## Version Information:
- Xamarin Studio 5.7.1
- Xamarin.iOS 8.6.1.20

- XCode 6.1.1 (no change)
On pc (Visual Studio 2013) :
- Xamarin 3.9.289.0 
- Xamarin.iOS 8.6.1.0 
- Xamarin.iOS Unified Migration 1.0 (new)
Comment 2 Sadik Ali 2015-02-26 06:45:29 UTC
I have checked this issue with the help of given sample and able to reproduce the given behaviour.when I run the project on the simulator the the following exception occur:

Unhandled Exception:
Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: (null)

Screencast:http://www.screencast.com/t/HDRQBA3iTfx
Application Output:https://gist.github.com/saurabh360/564f79579334dcdcdc3f Ide Logs:https://gist.github.com/saurabh360/eaf8a5feb44c5d45fd99
MTB server logs: https://gist.github.com/Rajneesh360Logica/618eb9e900d23304b232

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00007

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0446016-02251
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0446016-02251
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0446016-02251
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0446016-02251
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0446016-02251
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0446016-02251
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446016-02251
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

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

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.9.346.0 (d6de844)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.6.2.0 (862702c6b8aa14a373e25f83ac45918556af41a2)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 3 mag@xamarin.com 2015-03-11 13:55:29 UTC
Fixed.

v3.9.3
Fix Commit Hash: 407874644d4a95405998da4a42391349edaf807e
Merge Commit Hash: e7ffee6e0bf32ffae0e94cc38c820192ef328b0e

master
Fix Commit Hash: f7aea90689462f921f7080070b17c8da9d20616d
Merge Commit Hash: 1e686af5a568e72e1cbe4e1e8f47cc5f7976cd1e
Comment 4 Saurabh 2015-03-13 02:51:25 UTC
I have checked this Issue using attached project with Cycle 4 Service Release 3 builds and I am still getting this exception on these builds.

http://www.screencast.com/t/uVfbTOuwllPt
Debug Output: https://gist.github.com/saurabh360/6afa55fee16977aff54a
Xamarin Log: https://gist.github.com/saurabh360/b6aefd77bbbd8db312ff
System Log: https://gist.github.com/saurabh360/1e7982519ea6d9699e8e

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0446016-02238
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0446016-02238
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0446016-02238
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0446016-02238
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0446016-02238
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0446016-02238
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446016-02238
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0446016-02238
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

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

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.9.519.0 (5667ef4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.37 (9e05e39f02bafe8fc0b7ab025d99f3b446835ad4)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.8.1.0 (61fa2c6e0f2ef51eb98b8810de13b4469f379cc7)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 5 mag@xamarin.com 2015-03-13 16:18:05 UTC
The described issue is already fixed. It was related to not copying the nib files correctly when added on iOS class libraries.

What is still causing problems is a known issue related to Any CPU Platform when building.
Basically, the class libraries are not being handled well and are being omitted during build. That's why we need to include the libraries on build, manually through Configuration Manager.

As mentioned, this is a known issue that needs to be fixed, but it's unrelated with this particular bug. The following is a bug related to this known issue (it has the same root cause):

https://bugzilla.xamarin.com/show_bug.cgi?id=25811

Below is a screencast that shows how to solve the problem by just including the library as part of the build process:

http://screencast.com/t/PzS0fEfj
Comment 6 Mohit Kheterpal 2015-03-17 07:56:17 UTC
I have checked this issue by following the steps mentioned in comment 5 using VS 2013 + XVS 3.9.523 + X.iOS 8.8.1.9 and observed that this issue is working fine now after including the library as part of the build process.

Hence closing this issue.

Thanks