Bug 18764 - CopyByDashingPath SIGSEGV crash
Summary: CopyByDashingPath SIGSEGV crash
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.2.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2014-04-02 15:26 UTC by John Miller [MSFT]
Modified: 2014-05-30 09:48 UTC (History)
3 users (show)

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

Repro Project (8.07 KB, application/zip)
2014-04-02 15:26 UTC, John Miller [MSFT]

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 or GitHub 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:

Description John Miller [MSFT] 2014-04-02 15:26:01 UTC
Created attachment 6467 [details]
Repro Project

myCGPath.CopyByDashingPath(float[]) causes a crash when used. Attached is a sample project that reproduces the problem. 

Runtime crash. See crash details below.

Expected Result:
No crash, returns dashed path. 

Additional Info:
Customer reported issue and provided this link which may be related: https://github.com/mono/maccore/pull/45/files

Crash Details:

mono-rt: Stacktrace:

mono-rt:   at <unknown> <0xffffffff>

mono-rt:   at (wrapper managed-to-native) MonoTouch.CoreGraphics.CGPath.CGPathCreateCopyByDashingPath (intptr,intptr,single[],int) <IL 0x0003b, 0xffffffff>

mono-rt:   at MonoTouch.CoreGraphics.CGPath.CopyByDashingPath (single[]) [0x00000] in /Developer/MonoTouch/Source/maccore/src/CoreGraphics/CGPath.cs:545

mono-rt:   at Case66194.Case66194ViewController.ViewDidLoad () [0x00045] in /Users/John/Projects/Cases/Case66194/Case66194/Case66194ViewController.cs:34

mono-rt:   at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>

mono-rt:   at <unknown> <0xffffffff>

mono-rt:   at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>

mono-rt:   at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38

mono-rt:   at Case66194.Application.Main (string[]) [0x00008] in /Users/John/Projects/Cases/Case66194/Case66194/Main.cs:16

mono-rt:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Version Info:

=== Xamarin Studio ===

Version 4.2.4 (build 32)
Installation UUID: bb00cd30-1c19-4ed5-b390-f732a454afd5
	Mono 3.2.6 ((no/9b58377)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 302060000

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 58c3efa
Build date: 2014-10-03 18:02:26-0400

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Version: 4.12.1 (Business Edition)
Android SDK: /Users/John/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Build Information ===

Release ID: 402040032
Git revision: a160c35dac9ab9fd32eeadaa171216316d5a5133
Build date: 2014-03-12 13:55:08-04
Xamarin addins: a779416ceabd54981ce812771a4061c942e8b872

=== Operating System ===

Mac OS X 10.9.2
Darwin Johns-WorkMacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2014-04-02 16:15:50 UTC
The sample does crash.

OTOH https://github.com/mono/maccore/pull/45/files is an unmerged pull request (unrelated, but it does show the code).
Comment 2 Sebastien Pouliot 2014-04-02 16:48:18 UTC
The p/invoke for CGPathCreateCopyByDashingPath is incorrect. I'll fix it and add some tests.
Comment 3 Sebastien Pouliot 2014-04-02 17:36:00 UTC
Fixed in master 99b5404ea50f5cd36f83f881ceddc0d113dd0fd2

The workaround is to p/invoke manually the native function. If needed we can provide the bits of code required (just need to be sure the sample has the overload that the user requires). Let me know...
Comment 4 John Miller [MSFT] 2014-04-07 15:09:41 UTC

That is the correct overload, 

path.CopyByDashingPath(new float[]{ 10, 10 });
Comment 6 narayanp 2014-05-30 09:48:40 UTC
I have checked this issue with following builds and run the attached project, It is working fine on both iOS Simulator and iOS Device.

All Mac 
X.S 5.1 (Build 261)
Git revision: f5f2b5e52eeab3d8ec5c7cc0e5cd59997992f99b