No constructor found for ViewController::.ctor(System.IntPtr) - xamarin.ios

I'm having an issue where my Monotouch application sometimes crashes just after receiving a memory warning. Please see that stack trace below.
Received memory warning. Level=2
DTMobileIS[2299] : _memoryNotification : {
OSMemoryNotificationLevel = 2;
timestamp = "2011-04-11 14:29:09 +0000";
}
Toplevel exception: System.MissingMethodException: No constructor found for Myapp.UI.BoardController::.ctor(System.IntPtr)
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in :0
at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in :0
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in :0
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in :0
at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x00000] in :0
at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr) [0x00000] in :0
at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in :0
at Myapp.Free.Application.Main (System.String[] args) [0x00000] in /Users/haakon/Code/Myapp-work/iOS/Myapp.Free/Myapp.Free/Main.cs:12
The stack trace is correct in that the indicated class (BoardController, which is a UIViewController subclass) lacks a constructor taking a IntPtr parameter. But this is intentional as I don't use Interface Builder at all in my application. So why does this happen?
I did find a similar question that seemed to suggest that this can happen if you allow your views (or possibly view controllers) to become garbage collected. But I don't see how this can happen here. Some background: My application delegate holds a strong reference to a navigation controller, which in turn holds a strong reference to the root view controller in the navigation stack. This root view controller also holds a strong reference to the BoardController instance. So I don't understand how it's possible that BoardController gets garbage collected.
Any ideas?

The IntPtr constructor is used when a native object needs to be surfaced to a managed object. In this particular case, you could be creating, like this:
var foo = new Foo ();
SomeObject.Property = foo;
This assigns the Foo object to the property, but if the Property is an Objective-C object, if you do not keep a reference to "foo", then Mono's GC will go ahead and dispose the linkage between the managed Foo and the unmanaged Foo.
Then, later on, you try to retrieve it:
var bar = SomeObject.Property;
Here, MonoTouch will know that there is no managed object anymore than maps to it, so it has to construct a new one, but all it has is the IntPtr to the Objective-C code. This is why you need the constructor.
You might be tempted to just add the native constructor, and this is fine in many cases, but it is a problem if your object has its own state stored in the managed world, for example:
public class Foo : UIView {
string Name;
public Foo () { Name= "Hello"; }
public Foo (IntPtr ptr) : base (ptr) {}
}
In this case, the IntPtr constructor can not completely reconstruct the managed object and its state merely from the IntPtr. So the likely source of your problem is that you are not keeping a reference to your object.
So the real fix in short is: keep a reference to your BoardController in your managed code to prevent the object from being collected when you are still going to use it later on.

Related

MvvmCross Xamarin IOS TextView Binding with conversion does no longer work

I have a Xamarin.IOS application and use MvvmCross and the ResxPlugin for translations. That workes without issues in debug. But since I updated from I guess 5.3.x to 5.6.3 the app crashes in release mode with the linker set to "Link Framework SDKs only" when I try to execute the following line:
bindingSet.Bind(textViewWelcomeMessage)
.For(txt => txt.Text)
.To(vm => vm.TextSource)
.WithConversion(new MvxLanguageConverter(), "WelcomeMessage");
This works without issues:
bindingSet.Bind(textFieldAgreementText)
.For(lbl => lbl.AttributedText)
.To(vm => vm.GeneralAgreementText)
.WithConversion("StringToHtml");
So I assume the problem lies somewhere in the MvxLanguageConverter in combination with textFields.
In my "LinkerPleaseInlude" file I have this added:
public void Include(UITextView textView)
{
textView.Text = textView.Text + "";
textView.AttributedText = new NSAttributedString();
textView.Changed += (sender, args) => { textView.Text = ""; };
}
The error message in the output is:
2018-01-24 09:37:39.415 ConnectContacts.Ios[27680:1063685] System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
Parameter name: sourceEventInfo
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (UIKit.NSTextStorage source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00017] in <6adc0d5857264558a9d45778a78ae02a>:0
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (UIKit.NSTextStorage source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00012] in <6adc0d5857264558a9d45778a78ae02a>:0
at MvvmCross.Platform.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) [0x00000] in <6adc0d5857264558a9d45778a78ae02a>:0
at MvvmCross.Binding.iOS.Target.MvxUITextViewTextTargetBinding.SubscribeToEvents () [0x00053] in <614c9ef828c14ba687a40ec2656f480f>:0
at MvvmCross.Binding.Bindings.MvxFullBinding.CreateTargetBinding (System.Object target) [0x00057] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.Bindings.MvxFullBinding..ctor (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x0002f] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.Binders.MvxFromTextBinder.BindSingle (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00000] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.Binders.MvxFromTextBinder+<>c__DisplayClass2_0.<Bind>b__0 (MvvmCross.Binding.Bindings.MvxBindingDescription description) [0x00018] in <866b1e46764b48aab0d408952a6f006f>:0
at System.Linq.Enumerable+SelectArrayIterator`2[TSource,TResult].MoveNext () [0x0003a] in <8bc31b0df50a4d32b3f1d5af764165ad>:0
at MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBindings (MvvmCross.Binding.BindingContext.IMvxBindingContextOwner view, System.Object target, System.Collections.Generic.IEnumerable`1[T] bindings, System.Object clearKey) [0x0001d] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBindings (MvvmCross.Binding.BindingContext.IMvxBindingContextOwner view, System.Object target, System.Collections.Generic.IEnumerable`1[T] bindingDescriptions, System.Object clearKey) [0x00018] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.BindingContext.MvxBindingContextOwnerExtensions.AddBinding (MvvmCross.Binding.BindingContext.IMvxBindingContextOwner view, System.Object target, MvvmCross.Binding.Bindings.MvxBindingDescription bindingDescription, System.Object clearKey) [0x0000b] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.BindingContext.MvxBaseFluentBindingDescription`1[TTarget].Apply () [0x0001f] in <866b1e46764b48aab0d408952a6f006f>:0
at MvvmCross.Binding.BindingContext.MvxFluentBindingDescriptionSet`2[TOwningTarget,TSource].Apply () [0x00016] in <866b1e46764b48aab0d408952a6f006f>:0
at ConnectContacts.Ios.Views.Wizard.WelcomeView.ViewDidLoad () [0x001ae] in <b2a318752d5d4fbeb6d32a83c8b6f752>:0
--- End of stack trace from previous location where exception was thrown ---
Do I have to make something different with the new version?
You need to add the following to your LinkerPleaseInlude for UITextView
textView.TextStorage.DidProcessEditing += (sender, e) => textView.Text = "";
See this GitHub issue

Xamarin SKPaymentQueue AddPayment throwing exception

In my Xamarin app when I call this method
private void MakePayment (SKProduct product)
{
SKPayment payment = SKPayment.PaymentWithProduct (product);
SKPaymentQueue.DefaultQueue.AddPayment (payment);
}
I get this error:
Failed to marshal the Objective-C object 0x14607110 (type:
SKPaymentTransaction). Could not find an existing managed instance for
this object, nor was it possible to create a new managed instance
(because the type 'MonoTouch.StoreKit.SKPaymentTransaction[]' does not
have a constructor that takes one IntPtr argument).
I'm not sure if I have something configured wrong or there is an issue in my code or Xamarin.
Here's the code for the Observer
internal class CustomPaymentObserver : SKPaymentTransactionObserver
{
private InAppPurchase inAppPurchase;
public CustomPaymentObserver (InAppPurchase inAppPurchase)
{
this.inAppPurchase = inAppPurchase;
}
public override void UpdatedTransactions (SKPaymentQueue queue, SKPaymentTransaction[] transactions)
{
Console.WriteLine ("UpdatedTransactions");
foreach (SKPaymentTransaction transaction in transactions) {
switch (transaction.TransactionState) {
case SKPaymentTransactionState.Purchased:
inAppPurchase.CompleteTransaction (transaction);
break;
case SKPaymentTransactionState.Failed:
inAppPurchase.FailedTransaction (transaction);
break;
default:
break;
}
}
}
public override void PaymentQueueRestoreCompletedTransactionsFinished (SKPaymentQueue queue)
{
}
public override void RestoreCompletedTransactionsFailedWithError (SKPaymentQueue queue, NSError error)
{
}
}
Here is the full stack trace:
System.Exception: Failed to marshal the Objective-C object 0x17ecb680 (type: SKPaymentTransaction). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'MonoTouch.StoreKit.SKPaymentTransaction[]' does not have a constructor that takes one IntPtr argument).
at MonoTouch.ObjCRuntime.Runtime.MissingCtor (IntPtr ptr, IntPtr klass, System.Type type, MissingCtorResolution resolution) [0x00046] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pp-Runtime.cs:352
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject[NSObject] (IntPtr ptr, System.Type type, MissingCtorResolution missingCtorResolution) [0x00000] in :0
at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr, System.Type target_type, MissingCtorResolution missingCtorResolution, System.Boolean& created) [0x00073] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pp-Runtime.cs:514
at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr, IntPtr type_ptr, System.Boolean& created) [0x0000c] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pp-Runtime.cs:686
at at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr,intptr,int&)
at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_IntPtr (intptr,intptr,intptr)
at MonoTouch.StoreKit.SKPaymentQueue.AddPayment (MonoTouch.StoreKit.SKPayment payment) [0x00014] in /Developer/MonoTouch/Source/monotouch/src/StoreKit/.pp-SKPaymentQueue.g.cs:109
at IOS.Util.IAP.InAppPurchase.ReceivedResponse (MonoTouch.StoreKit.SKProductsRequest request, MonoTouch.StoreKit.SKProductsResponse response) [0x0001d] in /Users/aaron/Projects/budget-ease-xamarin/IOS/Util/IAP/InAppPurchase.cs:43
at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UIApplication.cs:38
at IOS.Application.Main (System.String[] args) [0x00008] in /Users/aaron/Projects/budget-ease-xamarin/IOS/Main.cs:16
What's happened here is that the C# instance of your CustomPaymentObserver got garbage collected, while it's native ("Objective-C") counterpart lived on. When a notification was finally delivered, the native object tried to call into the now dead C# object and crashed your App.
To circumvent this, keep a reference to your CustomPaymentObserver e.g. in your AppDelegate to keep it alive.
I'm not sure this is documented somewhere for Xamarin.iOS (couldn't find something on a quick look), but I believe very similar for Xamarin.Droid (e.g. http://developer.xamarin.com/guides/android/advanced_topics/garbage_collection/)
I'm not really sure what was causing this. I thought it was perhaps something related to the linker. But I uninstalled Xamarin completely from my Mac (including all the MonoTouch stuff) and reinstalled everything and now it's working.

System.ExecutionEngineException: Attempting to JIT compile method 'System.Linq.Enumerable:<ToLookup`2>

here is my Code
public int GetUsersSqlCount()
{
// Here i get the Error
return this.GetUsersSql().Count();
}
public IEnumerable<CsUser> GetUsersSql()
{
return (from x in this._storage.CsUsers
join y in this._storage.CeMitarbs on x.MitNr equals y.MitNr
select x).OrderBy(x => x.KurzZch);
}
I get the following Error:
Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method 'System.Linq.Enumerable:<ToLookup`2>m__5A<Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CeMitarb, System.Nullable`1<int>> (Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CeMitarb)' while running with --aot-only.
at System.Linq.Enumerable.ToLookup[CeMitarb,Nullable`1,CeMitarb] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x00079] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2966
at System.Linq.Enumerable.ToLookup[CeMitarb,Nullable`1] (IEnumerable`1 source, System.Func`2 keySelector, IEqualityComparer`1 comparer) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2934
at System.Linq.Enumerable+<CreateJoinIterator>c__Iterator18`4[Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser,Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CeMitarb,System.Nullable`1[System.Int32],Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser].MoveNext () [0x00023] in /Developer/MonoTouch/Source/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:1157
at System.Collections.Generic.List`1[Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.ToArray[CsUser] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1[Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser]..ctor (IEnumerable`1 source, System.Linq.SortContext`1 context) [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1+<Sort>c__Iterator2F[Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CsUser].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.Count[CsUser] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at CSMobile.Logic.Forms.Login_Dal.GetUsersSqlCount () [0x00000] in /Volumes/Mobile2011/Mobile 2011/trunk/WinCE/CSMobile/CSMobile.Logic/Forms/Login.Dal.cs:38
at CSMobile.Logic.Forms.Login_Logic.GetUsers () [0x0001f] in /Volumes/Mobile2011/Mobile 2011/trunk/WinCE/CSMobile/CSMobile.Logic/Forms/Login.Logic.cs:198
at CSMobile.Logic.Forms.Login_Logic.Anmelden2 (Int32 selectedProduct) [0x00050] in /Volumes/Mobile2011/Mobile 2011/trunk/WinCE/CSMobile/CSMobile.Logic/Forms/Login.Logic.cs:416
at CSMobile.UI.Login.Logic_LoginStepCompleted (Login_StepResult result) [0x0003e] in /Volumes/Mobile2011/Mobile 2011/trunk/IOS/CSMobile/CSMobile.UI/Forms/Login.cs:325
at CSMobile.Logic.Forms.Login_Logic.Anmelden1 () [0x00084] in /Volumes/Mobile2011/Mobile 2011/trunk/WinCE/CSMobile/CSMobile.Logic/Forms/Login.Logic.cs:364
at CSMobile.UI.Login.StartLogin () [0x00000] in /Volumes/Mobile2011/Mobile 2011/trunk/IOS/CSMobile/CSMobile.UI/Forms/Login.cs:75
at CSMobile.UI.Login.Pad_Start_TouchUpInside (MonoTouch.Foundation.NSObject sender) [0x00000] in /Volumes/Mobile2011/Mobile 2011/trunk/IOS/CSMobile/CSMobile.UI/Forms/Login.cs:235
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:34
at CSMobile.UI.Application.Main (System.String[] args) [0x0000a] in /Volumes/Mobile2011/Mobile 2011/trunk/IOS/CSMobile/CSMobile.UI/Main.cs:18
[ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: Attempting to JIT compile method 'System.Linq.Enumerable:<ToLookup`2>m__5A<Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CeMitarb, System.Nullable`1<int>> (Genesis.DataAccess.Schema.Mobile.V1.Wrapper.CeMitarb)' while running with --aot-only.
I think this limitation here is actually due to Generic Virtual Methods - http://docs.xamarin.com/ios/about/limitations#Generic_Virtual_Methods
There's a discussion of a very similar problem on the mailing list:
http://monotouch.2284126.n4.nabble.com/LINQ-JIT-error-again-td3800970.html;cid=1338984263803-35#a3800169
It didn't sound like that thread found a solution
It might be worth contacting Xamarin support directly on this one. http://bugzilla.xamarin.com/
Generics are a bit weird on MonoTouch due to AOT compilation. A true runtime / JIT is disallowed in iOS, so it must compile everything ahead-of-time.
In this particular case, your method which returns IEnumerable<CsUser> is most likely the culprit. Generic interfaces cause problems. Try changing your return type to a List<CsUser> or any other concrete class that implements IEnumerable<CsUser>.
OrderBy is known to fail in this scenario. This appears to be fixed in MonoTouch version 2.10 but unfortunately if you're using an engine like Unity, that only ships with 2.6 currently (as of 4.3.x).
https://bugzilla.xamarin.com/show_bug.cgi?id=2155#c11
I don't know a convenient solution for Xamarin at the moment.
However there is such a solution for Unity 3D.
You can try LINQ to iOS. It's a custom implementation of LINQ to Objects extension methods that works on iOS without JIT-compile errors. If you're using Xamarin you may try to take .dll from LINQ to iOS and use it in your project. After all, Xamarin and Unity both use Mono compiler.

Selector invoked from objective-c on a managed object that has been GC'ed, how to avoid viewcontrollers from being GC'd

We have an app in the appstore that works without any issues on iPhone 4g/4gs but when I tested it on an iPod I got a surprise because it crashes all the time at "random" places. Looking at the strack traces it seems my viewcontrollers have been GC'ed.
Will the viewcontroller be garbagecollected if I write methods like this:
public void PushShowTeamController (Object a)
{
var teamController = new TeamController (a);
NavigationController.PushViewController (teamController, true);
}
Because the iPod suddently throws an error like this:
Jan 6 18:52:09 unknown MyApp[5197] <Warning>: Received memory warning.
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: Unhandled Exception: System.Exception: Selector invoked from objective-c on a managed object that has been GC'ed ---> System.MissingMethodException: No constructor found for MyApp.TeamController::.ctor(System.IntPtr)
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0
Jan 6 18:52:10 unknown UIKitApplication:mypackage.app[0x9db2][5197] <Notice>: --- End of inner exception stack trace ---
This will happen when an managed object is disposed (when no reference is left to an instance) and the object is later resurfaced by native code.
You need to ensure that a reference to MyApp.TeamController is kept in managed code as long as it can be required (e.g. accessed) by native code.
In most case MonoTouch will ensure a reference is kept. Your code:
NavigationController.PushViewController (teamController, true);
is correct and UINavigationController will keep a reference to your teamController. However if you call PushViewController on another controller then the first reference will be overwritten and will be collectable by the garbage collector (GC). This situation would lead to the exception you are seeing.
Note: because you can't predict when the GC will collect unreferenced object instance the exception will appear to be thrown randomly.
From my experience this happens when i use a lot of dispose() on managed objects instead of setting them to null and leaving the GC to do its job. Also anonymous delegates combined with dispose() can lead to such problems

EMGU library OPENCV problem with native memroy management - does really work with mono?

we are working in a project involving the use of EMGU and in particoular the SVM functions of OpenCV and we have a problem using Mono on a Ubuntu platform and we don't have this problem on windows. The problem appears when we call the Emgu.CV.ML.SVM.Train method. All the parameters are correct and we canno't debug the wrapped code...
We have tried to increase the Shared Memory and other tricks but it doesn't work.
Do you have any idea?
Thank you
Angelo
Unhandled Exception: Emgu.CV.CvException: OpenCV: requested size is negative or too big
at Emgu.CV.CvInvoke.CvErrorHandler (Int32 status, System.String funcName, System.String errMsg, System.String fileName, Int32 line, IntPtr userData) [0x00000]
at (wrapper native-to-managed) Emgu.CV.CvInvoke:CvErrorHandler (int,intptr,intptr,intptr,int,intptr)
at (wrapper managed-to-native) Emgu.CV.ML.MlInvoke:CvSVMTrain (intptr,intptr,intptr,intptr,intptr,Emgu.CV.ML.Structure.MCvSVMParams)
at Emgu.CV.ML.SVM.Train (Emgu.CV.Matrix`1 trainData, Emgu.CV.Matrix`1 responses, Emgu.CV.Matrix`1 varIdx, Emgu.CV.Matrix`1 sampleIdx, Emgu.CV.ML.SVMParams parameters) [0x00000]
at Segmentation.ImageFeatures.LeafHog.TrainModel (IDictionary`2 dicInOutImage) [0x00000]
at Segmentation.ImageSegmentators.Composite.TrainModel (IDictionary`2 dicInOutImage) [0x00000]
at Segmentation.ImageSegmentators.CompositionMlpRprop.TrainModel (IDictionary`2 dicInOutImage) [0x00000]
at Segmentation.GeneticConfig.ChromoCreator.GetASegmentation (IConfigChromosome configChromosome, IDictionary`2 dicInOutImageTrain) [0x00000]
at Segmentation.GeneticConfig.ConfigChromoProvider.AddChromosomeIfNew (IConfigChromosome chromo) [0x00000]
at Segmentation.GeneticConfig.ConfigChromosome.Generate () [0x00000]
at Segmentation.GeneticConfig.ConfigChromosome..ctor (Int32 chromoLength, IConfigChromoProvider cProvider) [0x00000]
at Segmentation.GeneticConfig.ConfigChromosome.CreateNew () [0x00000]
at AForge.Genetic.Population..ctor (Int32 size, IChromosome ancestor, IFitnessFunction fitnessFunction, ISelectionMethod selectionMethod) [0x00000]
at SegmentationCLI.Program.Main (System.String[] args) [0x00000]

Resources