Bug 24468 - NSString.StringSize causes debugger to crash in Unifed Projects
Summary: NSString.StringSize causes debugger to crash in Unifed Projects
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 3.7
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-12 12:30 UTC by Cody Beyer (MSFT)
Modified: 2016-12-23 05:41 UTC (History)
10 users (show)

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


Attachments
TestCase/Logs/Version (11.60 KB, application/zip)
2014-11-12 12:30 UTC, Cody Beyer (MSFT)
Details


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 Cody Beyer (MSFT) 2014-11-12 12:30:13 UTC
Created attachment 8702 [details]
TestCase/Logs/Version

### Description

It appears that setting NSString.StringSize causes the debugger to crash during runtime

### Test Case

Attached

### Steps to Reproduce

1. Open test case in Visual Studio
2. Attempt to debug
3. Notice debugger exiting

### Application output

Attached

### Environment Details

Attached
Comment 2 Rajneesh Kumar 2014-11-13 03:40:44 UTC
I have checked this issue and observed that the application crash during run-time. To reproduce this issue I have followed the steps and sample application provided in bug description. 

Steps I followed:
1. Open attached test application in VS.
2. Debug the application, on simulator.
3. Observed that, as it deploy on simulator.
4. Debugger exiting frequently.  

I observed that the application crash during run-time.

Could you please confirmed that is this the same behavior experiencing you? If no, please let me know that what steps I am missing to reproduce this issue? Please refer the screencast.
Screencast: http://www.screencast.com/t/CkLJx2nmFI

App O/P: https://gist.github.com/Rajneesh360Logica/668814a5c14193fa8e3f

VS trace logs: https://gist.github.com/Rajneesh360Logica/1f7aadd8c6e5a0d16135

Mac server Log:
https://gist.github.com/Rajneesh360Logica/c045fe745163a766a292

mtbserver log: https://gist.github.com/Rajneesh360Logica/3db9d087a6475db40cba

Please let me know if I am missing anything?

Environment Info:

===MAC===
Operating System
Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
[2:05:58 PM] datatransfer360:

 Xamarin.iOS
Version: 8.4.0.16 (Business Edition)

===Windows====

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0444002-02032
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0444002-02032
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02032
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02032
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02032
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02032
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02032
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-0444002-02032
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.3.50717.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.20703.0
For additional information, visit http://www.asp.net/

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

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50313.46
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.2
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.30919.1
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.7.248.0 (8ca7d11db8a6f874c6cd2de6d9ca0f511867ce91)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.1.3 (5474129af31e9d3a86cb7482c7c5c7a30ad315f1)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.4.0.0 (209abebbd8f1a292d042420edb45fa5fbd3f017b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 3 Patrik P 2014-11-13 06:23:38 UTC
Rajneesh, your tests seem to confirm my own findings.

Note that built app will crash regardless of having debugger attached. This also seems Visual Studio build specific, as I can not reproduce on Xamarin Studio on Mac. Only happens on Unified API apps, classic apps using the same code work fine.

Also reproducible using NSString.GetBoundingRect:

var constrainSize = new CGSize(200, 30 * lineCount);
var stringSize = new NSString(@string).GetBoundingRect(constrainSize, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes() { Font = UIFont.SystemFontOfSize(12) }, null);


Output:
objc[41428]: Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.
objc[41428]: receiver 0xbffca2f8, SEL 0x7b450e40, isa 0x143fa4f0, cache 0x143fa4f8, buckets 0x7b499860, mask 0x0, occupied 0x0
objc[41428]: receiver 0 bytes, buckets 144 bytes
objc[41428]: selector 'XcN�'



Environment:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-179-2586894-02364
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-179-2586894-02364
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-179-2586894-02364
Microsoft Visual Basic 2013

Visual C# 2013   06177-179-2586894-02364
Microsoft Visual C# 2013

Visual C++ 2013   06177-179-2586894-02364
Microsoft Visual C++ 2013

Visual F# 2013   06177-179-2586894-02364
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-179-2586894-02364
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-179-2586894-02364
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.3.50717.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.20703.0
For additional information, visit http://www.asp.net/

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

JetBrains ReSharper 8.2.2   C# Edition build 8.2.2000.5102 on 2014-08-30T16:12:46
JetBrains ReSharper 8.2.2 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50313.46
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.2
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.30919.1
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.7.248.0 (8ca7d11db8a6f874c6cd2de6d9ca0f511867ce91)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.1.3 (5474129af31e9d3a86cb7482c7c5c7a30ad315f1)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.4.0.0 (209abebbd8f1a292d042420edb45fa5fbd3f017b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 4 Jose Gallardo 2016-12-22 21:20:43 UTC
Hi,
As we've introduced several improvements around VS/Mac connectivity and the iOS build system, I'll mark the bug as resolved fixed.
Please feel free to reopen it if you can still reproduce the issue with current bits.
Thanks!