Bug 18811 - Problem to execute my application with the simulator
Summary: Problem to execute my application with the simulator
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.2.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-04-04 05:25 UTC by Alain
Modified: 2014-04-04 09:16 UTC (History)
3 users (show)

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

Problem Version 3.2.4 (2.58 MB, application/octet-stream)
2014-04-04 07:28 UTC, Alain
Problem Version 3.2.4 (22.23 KB, application/octet-stream)
2014-04-04 08:58 UTC, Alain

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 Alain 2014-04-04 05:25:04 UTC

I installed the 3.2.4 version of Mono and IOS7.2.1

When I compile my application, I have no errors. When I launch the application on the simulator , I have the following messages:

2014-04-04 11:15:45.469 MedinectIPad [ 14847 : a07 ] System.AggregateException : One or more errors occured ---> MonoTouch.MonoTouchException : Could not register the selector ' delegate ' of the member ' eIDCarte.iSmartReader.get_DelegateCard 'Because the selector is already registered on the member' get_Delegate .
  --- End of inner exception stack traces ---
 -> (Inner exception 0) MonoTouch.MonoTouchException : Could not register the selector ' delegate ' of the member ' eIDCarte.iSmartReader.get_DelegateCard ' Because the selector is already registered on the member ' get_Delegate .

 -> (Inner exception 1) MonoTouch.MonoTouchException : Could not register the selector ' setDelegate ' of the member ' eIDCarte.iSmartReader.set_DelegateCard ' Because the selector is already registered on the member ' set_Delegate .

I have a laptop with which I always Mono 3.1.7 and 7.2.0 IO and the same application version, I have no errors.

Can you tell me what should I do?

I would put the pending 3.1.7 version on my iMac but I do not know how I can download ?

Comment 1 Sadik Ali 2014-04-04 07:09:56 UTC
I have checked this and unable to reproduce at my end, I have followed below steps:

1. Created iOS project
2. Build and deploy application on simulator successfully.

Screen cast: http://screencast.com/t/do1qACOgM

Build Info:

=== Xamarin Studio ===
Version 4.2.3 (build 60)
Installation UUID: b1fc3b76-cf00-405e-a0a1-3839ac11fe6d
	Mono 3.2.4 ((no/294f999)
	GTK+ 2.24.20 theme: Raleigh
	GTK# (
	Package version: 302040000

=== Apple Developer Tools ===
Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.Mac ===
Xamarin.Mac: 1.6.27
=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 46b2486

=== Build Information ===
Release ID: 402030060
Git revision: 30c4afc300c2a39ec5300851357ce02e49dd217e
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044

=== Operating System ===
Mac OS X 10.9.3
Darwin Apples-iMac.local 13.2.0 Darwin Kernel Version 13.2.0
    Mon Mar 24 19:18:06 PDT 2014
    root:xnu-2422.100.10~2/RELEASE_X86_64 x86_64

Could you please provide some more details steps so that so that I can reproduce at my end?

Also Can you please check on Mono 3.2.6 latest stable?
Comment 2 Alain 2014-04-04 07:28:35 UTC
Created attachment 6498 [details]
Problem Version 3.2.4

I made a small application with the DLL that problem. This DLL allows you to use an eID card reader. 

When I compile this small test application. it works perfectly. 

In my main project when I compile everything. No problem, at runtime, I get this message. 

Starting iPad simulator 6.1
Launching application
Application launched. PID = 15960
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/monotouch.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.dll [External]
Thread started:  #2
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/MedinectIPad.exe
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/DLLMedinect.dll
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/ActionTray.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.Core.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.Xml.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.Web.Services.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/Mono.Data.Sqlcipher.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.Data.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/System.Transactions.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/GlobalTools.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/StructuresLib.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/MedinectSQLLib.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/KmehrLib.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/TranslationLib.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/LaboLib.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/ZipArchive.dll [External]
Loaded assembly: /Users/RogisterMAC/Library/Application Support/iPhone Simulator/6.1/Applications/44DFEE27-74FF-42D4-A783-3F807D0B7516/MedinectIPad.app/Freedelity.dll [External]
2014-04-04 13:23:14.681 MedinectIPad[15960:a07] System.AggregateException: One or more errors occured ---> MonoTouch.MonoTouchException: Could not register the selector 'delegate' of the member 'eIDCarte.iSmartReader.get_DelegateCard' because the selector is already registered on the member 'get_Delegate'.
  --- End of inner exception stack trace ---
 --> (Inner exception 0) MonoTouch.MonoTouchException: Could not register the selector 'delegate' of the member 'eIDCarte.iSmartReader.get_DelegateCard' because the selector is already registered on the member 'get_Delegate'.

 --> (Inner exception 1) MonoTouch.MonoTouchException: Could not register the selector 'setDelegate:' of the member 'eIDCarte.iSmartReader.set_DelegateCard' because the selector is already registered on the member 'set_Delegate'.

I send you the DLL in question.

=== Xamarin Studio ===

Version 4.2.4 (build 32)
Installation UUID: 3363639e-cfcb-437b-ade7-72fcbb862f16
	Mono 3.4.0 ((no/d4511ef)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000185

=== Apple Developer Tools ===

Xcode 5.0.2 (3335.32)
Build 5A3005

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Not Installed

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 46b2486
Build date: 2014-03-24 15:04:26-0400

=== 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 rogistermac.appl-lan.be 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

To work, I need the version 3.2.7 and not 3.2.6 because in the version 3.2.6, I had a problem with the compilator. The version 3.2.7 resolve this problem. Can you send the version 3.2.7 ?


Comment 3 Sebastien Pouliot 2014-04-04 08:42:50 UTC
Alain, you cannot register the same selector (i.e. "delegate") more than once on a type. 

The ObjC runtime does not support that - but does not complain either (leading to random failures).

The new registrars in XI 7.2.1 (see release notes for details [1]) will spot such errors for you. You'llneed to fix the bad [Export] in your code.

You can (but should *not*) turn off the new registrars [1] to get back to the "old" (check-less) version. However, even if this fix the build, that only hides (not fix) the issues.

[1] http://docs.xamarin.com/releases/ios/xamarin.ios_7/xamarin.ios_7.2/#1
Comment 4 Alain 2014-04-04 08:58:13 UTC
Created attachment 6499 [details]
Problem Version 3.2.4

Ok, I added this line: 

- registrar: legacy 

and it works correctly. 

If you do not mind, I send you the file I made to transform a library. Has DLL MonoTouch. 

Can there be a problem in there but it compiles perfectly. 

Just another important question for me. We are in debug mode of our application and therefore intensive use. 

It is noted that the application crashes after 1 hour, 2 hours of use. it depends a bit. it never plant the same place that makes me think it is a memory problem that does not empty. 

I saw with version 7.2.1 the garbage collector was operational FULL for IOS applications. Do you think it can solve the problem we face? 

thank you 

Comment 5 Sebastien Pouliot 2014-04-04 09:16:35 UTC
> - registrar: legacy 

That confirm it's the registrar (new) checks. You better fix your code (and remove the duplicate selector) than keep using this option.

> Can there be a problem in there but it compiles perfectly. 

The sources will always compile. The C# compiler (and the AOT compiler) are unaware of the ObjC runtime, for them it's just some metadata (the [Export] attributes).

The checks are done at runtime, by XI registrar (since Apple does not do them). Having duplicate selectors is one (of the many) check(s) added in 7.2.1 to ensure you won't run into hard-to-diagnose issues while executing your applications.

> the garbage collector was operational FULL for IOS

The GC was already fully operational. What's new is the new-refcount (NRC) extensions: that helps to keep some instance referenced. So it's not, generally, saving memory - but it will avoid crashes due to unreferenced objects. 

Still it can, indirectly, save memory since every NSObject instances will require less memory (most backing fields will be removed). 

The removal of the backing fields can also solve some extra references to NSObject that makes it hard to reclaim objects (again it can reduce your memory consumption). 

In both cases it's hard to predict how much it will help, it's application specific - but even if minimal the savings are still savings :)

> Do you think it can solve the problem we face? 

There's not enough details to answer this. Try to get some (symbolicated) crash report and you'll see not only where but how it crashed (e.g. if it's running out of memory).

If it's a memory issue then you can try to use Instruments to see where it comes from. If managed memory is not reclaimed then you can use HeapShot to identify where it comes from.

You can also compare the memory consumption of your application with and without NRC enabled. That will tell you how much you gain by using the new NRC feature.

There are videos from Evolve 2013 that shows you how to use those tools. Just make sure, when measuring, to use the Release (not Debug) configuration. Debug requires a lot more memory (and code) and won't give you accurate results (i.e. things will look worse than they really are for end-users).