Bug 9410 - MonoTouch Crashes with EXC_BAD_ACCESS Exception when loading RedLaser Sample Project
Summary: MonoTouch Crashes with EXC_BAD_ACCESS Exception when loading RedLaser Sample ...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.1.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-01-08 19:30 UTC by Has
Modified: 2013-06-04 08:20 UTC (History)
3 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 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:
Status:
RESOLVED FIXED

Description Has 2013-01-08 19:30:47 UTC
I got the Sample of RedLaser project from monotouch/bindings/ on Github. 

I needed to update the makefile (provided on Github https://github.com/chrisbranson/monotouch-bindings/blob/master/RedLaser/binding/Makefile) to expect RedLaser 3.4.0 SDK and build no 194 instead of the provided values. 

I am able to compile, build, and run the application (RedLaser Sample) on my machine after few tweaks.

However once I click on the Scan button from the Home Screen, the application crashes. I cannot see any exception, Errors, or warnings on the Application Output panel on MonoDevelop. I could not find any Log either. The application is running on the iOSSimulator.

The issue happens when the OverrlayController tries to load the ParentPicker. Even just checking its value crashes the application.

I have put a sample of the code where it is crashing. I found that there was an issue with QRCode here, so I disabled QRScanning. but still the same crash. I am using

Monotouch 6.0, MonoDevelop 3.0.5, RedLaser 3.4.0

Any help would be greatly appreciated.

public partial class RLSampleViewController : UIViewController
{
    public RLSampleViewController (IntPtr handle) : base (handle) { }
    partial void scanPressed (MonoTouch.UIKit.UIBarButtonItem sender)
    {
         //THIS IS THE LINE WHERE THE APP IS JUST CRASHING 
         if (overlayController.ParentPicker == null)
         {
             BarcodePickerController picker = new BarcodePickerController ();
             // setup picker
             picker.Overlay = overlayController;
             picker.Delegate = new BarcodePickerDelegate (this);
             // Initialize with portrait mode as default
             picker.Orientation = UIImageOrientation.Up;
            // The active scanning region size is set in OverlayController.m
          }

         // The rest of the code was ignored
I have updated the question to include the crash log (Thanks to Rolf B. for pointing me to where to find it). However, it still does not make any sense to me as I do not have familiarity with Objective-C.

> Process:         RedLaserSample [10999]
> Path:            /Users/USER/Library/Application Support/iPhone
> Simulator/*/RedLaserSample.app/RedLaserSample
> Identifier:      RedLaserSample
> Version:         ???
> Code Type:       X86 (Native)
> Parent Process:  launchd [243]
> User ID:         501

> Date/Time:       2013-01-08 16:58:35.532 +1100
> OS Version:      Mac OS X 10.8.2 (12C60)
> Report Version:  10

> Crashed Thread:  0  Dispatch queue: com.apple.main-thread

> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000bf7ffffc

> VM Regions Near 0xbf7ffffc:
>     Stack                  00000000b056d000-00000000b057d000 [   64K] rw-/rwx SM=COW  
> --> Stack                  00000000bc000000-00000000bf800000 [ 56.0M] ---/rwx SM=NUL  
>     Stack                  00000000bf800000-00000000c0000000 [ 8192K] rw-/rwx SM=COW  

> Application Specific Information:
> iPhone Simulator 358.4, iPhone OS 6.0 (iPhone/10A403)


> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   CoreFoundation                    0x0405f6cd typeStringHash + 13
> 1   CoreFoundation                    0x03fffdb0 __CFDictionaryHashKey + 32
> 2   CoreFoundation                    0x03fe53e2 CFBasicHashFindBucket + 1426
> 3   CoreFoundation                    0x03fe4e2d CFDictionaryGetValue + 109
> 4   CoreFoundation                    0x0405e0ea +[NSMethodSignature signatureWithObjCTypes:] + 250
> 5   CoreFoundation                    0x040fb5c3 -[NSObject(NSObject)  methodSig
Comment 1 Has 2013-01-08 20:08:21 UTC
I have uploaded the Sample project that I am using to Dropbox, you can access it on:
https://dl.dropbox.com/u/2531161/RedLaserSample.zip
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-01-10 05:04:49 UTC
The crash is actually a stack overflow, caused by the RedLaser binding not being prepared for subclassing (and you've subclassed CameraOverlayViewController).

I've fixed this, and you can get updated bindings from https://github.com/mono/monotouch-bindings

master: 212c2ec6234b08dfac773d023ab501eef99522d2
Comment 3 Aaron 2013-06-04 08:05:26 UTC
A lot of thanks. Works fine with QR Code. However, the Data matrix decoding does not work. You have any idea about this problem?.

Thanks.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-06-04 08:20:23 UTC
Offhand I do not know why Data matrix decoding might not work.

If you think it's a but in MonoTouch please file a new bug report with a test case (since it's a different issue), otherwise I suggest you contact RedLaser about it.