[Mono-bugs] [Bug 676891] New: Marshal.Copy works in simulator, but fails on iOS device...

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 3 20:30:05 EST 2011



           Summary: Marshal.Copy works in simulator, but fails on iOS
    Classification: Mono
           Product: MonoTouch
           Version: SVN
          Platform: iPhone
        OS/Version: Apple iOS 4.2
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: gnorton at novell.com
        ReportedBy: Dominique at SavageSoftware.com.au
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=417493)
 --> (http://bugzilla.novell.com/attachment.cgi?id=417493)
Marshal Copy crash on device TestCase.

User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b12)
Gecko/20100101 Firefox/4.0b12

Essentially code that uses a Marshal.Copy to extract pixel information form an
IntPtr buffer, works perfectly well in the simulator, but crashes when the same
code is deployed to an iOS device. I've tested this on both iPhone and iPad,
with the same crash.

Reproducible: Always

Steps to Reproduce:
1. Load up attached project
2. Build for Simulator
3. Run, a spinning quad will appear
4. Build for Device
5. Run, and the app will crash on the case statement inside OnLoad() just below
case SurfaceFormat.Rgba32 /*kTexture2DPixelFormat_RGBA8888*/:
case SurfaceFormat.Dxt3 :
When the Marshal.Copy call is made.
Actual Results:  
As described above.

Expected Results:  
I expected it to work exactly like it does in the simulator.

This only seems to crash with 32bit images.

Crash log/stack trace below

User assembly
is missing. Debugger will now debug all code, not just user code.
Loaded assembly:
Loaded assembly:
Loaded assembly:
Loaded assembly:
Could not insert pending breakpoint at 'Main.cs:122'. Perhaps the source line
does not contain any statements, or the source does not correspond to the
current binary.
Thread started: 
Could not insert pending breakpoint at 'Main.cs:122'. Perhaps the source line
does not contain any statements, or the source does not correspond to the
current binary.
Resolved pending breakpoint at 'EAGLView.cs:317' to Void
MarshalCopyTestCase.EAGLView:OnLoad () [0x000fa].
Resolved pending breakpoint at 'EAGLView.cs:333' to Void
MarshalCopyTestCase.EAGLView:OnLoad () [0x0018a].

  at (wrapper managed-to-native)
(intptr,int,System.Array,int) <0xffffffff>
  at System.Runtime.InteropServices.Marshal.Copy (intptr,byte[],int,int)
  at MarshalCopyTestCase.EAGLView.OnLoad (System.EventArgs) [0x00092] in
  at OpenTK.Platform.iPhoneOS.iPhoneOSGameView.Run (double) <0x0009f>
  at MarshalCopyTestCase.AppDelegate.FinishedLaunching
(MonoTouch.UIKit.UIApplication) [0x00000] in
  at (wrapper runtime-invoke) object.runtime_invoke_dynamic
(intptr,intptr,intptr,intptr) <0x000cb>
  at (wrapper managed-to-native)
MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000e8>
  at MonoTouch.UIKit.UIApplication.Main (string[]) <0x0002b>
  at MarshalCopyTestCase.Application.Main (string[]) [0x00000] in
  at (wrapper runtime-invoke) object.runtime_invoke_dynamic
(intptr,intptr,intptr,intptr) <0x000cb>

Native stacktrace:

    0   MarshalCopyTestCase                 0x003229a0
mono_handle_native_sigsegv + 404
    1   MarshalCopyTestCase                 0x0030c078
mono_sigsegv_signal_handler + 348
    2   libSystem.B.dylib                   0x32d24487 _sigtramp + 34
    3   libSystem.B.dylib                   0x32d32075 __memcpy_chk + 16
    4   libSystem.B.dylib                   0x32d32075 __memcpy_chk + 16
    5   MarshalCopyTestCase                 0x003ac40c __inline_memcpy_chk + 44
    6   MarshalCopyTestCase                 0x003ca218
ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged + 496
    7   MarshalCopyTestCase                 0x00225750 (wrapper
managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged
(intptr,int,System.Array,int) + 88
    8   MarshalCopyTestCase                 0x003020cc
MarshalCopyTestCase.EAGLView:OnLoad (System.EventArgs) + 1212
    9   MarshalCopyTestCase                 0x0008e6cc
OpenTK.Platform.iPhoneOS.iPhoneOSGameView:Run (double) + 160
    10  MarshalCopyTestCase                 0x002feccc
(MonoTouch.UIKit.UIApplication) + 180
    11  MarshalCopyTestCase                 0x00270590 (wrapper runtime-invoke)
object:runtime_invoke_dynamic (intptr,intptr,intptr,intptr) + 204
    12  MarshalCopyTestCase                 0x0030bcf0 mono_jit_runtime_invoke
+ 3032
    13  MarshalCopyTestCase                 0x003eab40 mono_runtime_invoke +
    14  MarshalCopyTestCase                 0x0046c7e4 monotouch_trampoline +
    15  UIKit                               0x3386d02c -[UIApplication
_callInitializationDelegatesForURL:payload:suspended:] + 1200
    16  UIKit                               0x33866a78 -[UIApplication
_runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 396
    17  UIKit                               0x338202e4 -[UIApplication
handleEvent:withNewEvent:] + 1476
    18  UIKit                               0x3381fb1c -[UIApplication
sendEvent:] + 68
    19  UIKit                               0x3381f3b4
_UIApplicationHandleEvent + 6824
    20  GraphicsServices                    0x35262c88 PurpleEventCallback +
    21  CoreFoundation                      0x35e9a5cb
    22  CoreFoundation                      0x35e9a589 __CFRunLoopDoSource1 +
    23  CoreFoundation                      0x35e8c835 __CFRunLoopRun + 580
    24  CoreFoundation                      0x35e8c50b CFRunLoopRunSpecific +
    25  CoreFoundation                      0x35e8c419 CFRunLoopRunInMode + 60
    26  UIKit                               0x33865554 -[UIApplication _run] +
    27  UIKit                               0x33862558 UIApplicationMain + 972
    28  MarshalCopyTestCase                 0x001276d0 (wrapper
managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr) + 240
    29  MarshalCopyTestCase                 0x00111d6c
MonoTouch.UIKit.UIApplication:Main (string[]) + 44
    30  MarshalCopyTestCase                 0x002feaf4
MarshalCopyTestCase.Application:Main (string[]) + 132
    31  MarshalCopyTestCase                 0x00270590 (wrapper runtime-invoke)
object:runtime_invoke_dynamic (intptr,intptr,intptr,intptr) + 204
    32  MarshalCopyTestCase                 0x0030bcf0 mono_jit_runtime_invoke
+ 3032
    33  MarshalCopyTestCase                 0x003eab40 mono_runtime_invoke +
    34  MarshalCopyTestCase                 0x003ece34 mono_runtime_exec_main +
    35  MarshalCopyTestCase                 0x003ec5cc mono_runtime_run_main +
    36  MarshalCopyTestCase                 0x00312908 mono_jit_exec + 216
    37  MarshalCopyTestCase                 0x003073ec main + 3468
    38  MarshalCopyTestCase                 0x00002830 start + 52

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.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list