SIGABRT when subscribe an event - mini-generic-sharing: inflated_method->klass == inflated_class'

Hello,

I have a sigabrt when I try to suscribe an event. This error is only on devices

error: * Assertion at /Users/builder/data/lanes/4466/9995504e/source/xamarin-macios/external/mono/mono/mini/mini-generic-sharing.c:642, condition `inflated_method->klass == inflated_class' not met

Does anyone know how to solve this problem?

Answers

  • JGoldbergerJGoldberger Xamurai USMember, Forum Administrator, Xamarin Team, University Xamurai

    @jordan.connectivit

    Can you show the code that you are using? What type of event on what type of object are you subscribing to?

  • jordan.connectivitjordan.connectivit FRMember
    edited March 2017

    @JGoldberger

    I try to subscribe on one of my custom event on one of my custom object.

    Here my code :

    public AViewModel(ASearch<T> item)
    {
          Item = item;
          try
          {
               Item.NewItemsLoaded += Item_NewItemsLoaded; // <-- Here SIGABRT
          }
          catch (Exception ex)
          {
          }
    }
    

    Here event class of ASearch object

    public class NewItemsLoadedEventArgs : EventArgs
    {
          private List<T> _newItems;
          public List<T> newItems {
               get {
                    return this._newItems;
               }
               set {
                    this._newItems = value;
               }
          }
    
          public NewItemsLoadedEventArgs (List<T> newItems)
          {
               this.newItems = newItems;
          }
    }
    

    This code works on iOS Emulator and on Android.

    Let me know if you need more informations

    Thanks

    EDITED: for better code formatting

  • JGoldbergerJGoldberger Xamurai USMember, Forum Administrator, Xamarin Team, University Xamurai

    @jordan.connectivit

    You gave the code for the event arguments not the ASearch object as indicated.

  • jakkajjakkaj AUMember

    @JGoldberger your @ tag got the wrong Jordan :)

  • JGoldbergerJGoldberger Xamurai USMember, Forum Administrator, Xamarin Team, University Xamurai

    Oh, sorry, darn periods.

    @jordan.connectivit

    See above.

  • jordan.connectivitjordan.connectivit FRMember
    edited March 2017

    @JGoldberger

    Here the code of ASearch :)

     using System;
     using System.Collections;
     using System.Collections.Generic;
    
    
     namespace Test
    {
          public abstract class ASearch<T>
          {
               protected int index = 0;
               protected const int nbItems = 10;
               protected IDAOConfig config;
               private string _Search;
               protected List<T> items;
               protected List<T> partialItems;
    
               public string Search
               {
                    get
                    {
                         return this._Search;
                    }
                         set
                         {
                               this._Search = value;
                          }
               }
    
               public abstract List<T> Items { get; }
    
               public event ASearch<T>.OnNewItemsLoadedEventHandler NewItemsLoaded;
    
               public ASearch(IDAOConfig config)
               {
                    this.config = config;
               }
    
               protected abstract T CreateAndFillItem(object element);
    
               public abstract void LoadMoreItems();
    
               public virtual void OnNewItemsLoaded(ASearch<T>.NewItemsLoadedEventArgs e)
               {
                    if (this.NewItemsLoaded == null)
                         return;
    
                    this.NewItemsLoaded((object)this, e);
               }
    
               public void LoadNextItems(List<T> partialItems, IList selectedElements, List<T> newItems)
               {
                    for (int index = 0; index < 10; ++index)
                    {
                         if (partialItems.Count < selectedElements.Count)
                         {
                                   if (partialItems.Count != this.index)
                                        throw new Exception("partial list does not match with index, count error");
                                   T andFillItem = this.CreateAndFillItem(selectedElements[partialItems.Count]);
                                   newItems.Add(andFillItem);
                                   partialItems.Add(andFillItem);
                                   ++this.index;
                            }
                      }
               }
    
               protected virtual void TriggerEvent(List<T> newItems)
               {
                    this.OnNewItemsLoaded(new ASearch<T>.NewItemsLoadedEventArgs(newItems));
               }
    
               public class NewItemsLoadedEventArgs : EventArgs
               {
                    public object Parent;
                    private List<T> _newItems;
    
                    public List<T> newItems
                    {
                         get
                         {
                              return this._newItems;
                         }
                         set
                         {
                              this._newItems = value;
                         }
                    }
    
                    public NewItemsLoadedEventArgs(List<T> newItems)
                    {
                         this.newItems = newItems;
                    }
    
                    public NewItemsLoadedEventArgs(List<T> newItems, object parent)
                    {
                         this.newItems = newItems;
                         this.Parent = parent;
                    }
    
                    public bool IsFirstLevel()
                    {
                         return this.Parent == null;
                    }
               }
    
               public delegate void OnNewItemsLoadedEventHandler(object Sender, ASearch<T>.NewItemsLoadedEventArgs e);
          }
     }
    
  • JGoldbergerJGoldberger Xamurai USMember, Forum Administrator, Xamarin Team, University Xamurai

    @jordan.connectivit

    Hmm, that all looks good so I am not sure why you are getting that exception on iOS Device only. What are your linker settings for the iOS Device build? Look in your project options/properties in the iOS Build section for the "Linker behavior" field. What is that field's setting now? If not "Don't link" (or "None" if using Visual Studio) try that option and see what happens. If it works with "Don't Link" option then this is a bug we will need to get filed, and if so it would be great if you could provide a stripped down test project with the minimal code necessary to replicate the issue so we can reproduce the issue and track it down. Thanks!

Sign In or Register to comment.