Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Custom Renderer Crashing Mono on Android

$
0
0

I'm trying to make a custom renderer for a ListView control, but whenever I go to the page with that control on it, Visual Studio hard-locks (have to terminate it) and the application crashes on the emulator. I'm almost certain it has nothing to do with my specific renderer because breakpoints in the constructor or in OnElementChanged do not get fired before the crash happens. I think it is happening when it is trying to load the class.

I export it like this:

    [assembly: ExportRenderer(typeof(EntityList), typeof(EntityListRenderer))]

And the code is this, if it matters:

      public class EntityListRenderer : ViewRenderer<EntityList, ListView>, AdapterView.IOnItemClickListener {
            List<Entity> entities;
            EntityList entityList;

            public override Size MinimumSize() {
                return new Size(40, 40);
            }

            protected override void OnElementChanged(ElementChangedEventArgs<EntityList> e) {
                base.OnElementChanged(e);

                var listView = Control;
                if (listView == null) {
                    listView = new ListView(Context);
                    SetNativeControl(listView);
                }

                entityList = e.NewElement;

                entities = entityList.ItemsSource.ToList();
                listView.Adapter = new EntityListAdapter(e.NewElement.ItemsSource, Context);
                listView.OnItemClickListener = this;
            }

            public void OnItemClick(AdapterView parent, View view, int position, long id) {
                if (entityList != null) {
                    entityList.SendEntityTapped(entities[position]);
                }
            }
        }

Here are the only two things that appear related to a crash in LogCat:

    07-12 21:06:45.974: A/(1589): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/528056fd/source/mono/mono/mini/debugger-agent.c:7703, condition `mono_error_ok (&error)' not met
    07-12 21:06:45.978: E/mono-rt(1589): Stacktrace:
    07-12 21:06:45.978: E/mono-rt(1589): =================================================================
    07-12 21:06:45.978: E/mono-rt(1589): Got a SIGSEGV while executing native code. This usually indicates
    07-12 21:06:45.978: E/mono-rt(1589): a fatal error in the mono runtime or one of the native libraries 
    07-12 21:06:45.978: E/mono-rt(1589): used by your application.
    07-12 21:06:45.978: E/mono-rt(1589): =================================================================
    07-12 21:06:45.978: A/libc(1589): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 1605 (Manager.Android)
    07-12 21:06:46.098: I/DEBUG(106): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    07-12 21:06:46.098: I/DEBUG(106): Build fingerprint: 'generic/vbox86p/vbox86p:4.3/JLS36G/eng.buildbot.20140326.021524:userdebug/test-keys'
    07-12 21:06:46.110: I/DEBUG(106): Revision: '0'
    07-12 21:06:46.114: I/DEBUG(106): pid: 1589, tid: 1605, name: Manager.Android  >>> MyApp.Android <<<
    07-12 21:06:46.118: I/DEBUG(106): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 94085000
    07-12 21:06:46.478: I/DEBUG(106):     eax 92c0dbf0  ebx 97f95ff4  ecx 979080e8  edx 00000000
    07-12 21:06:46.478: I/DEBUG(106):     esi b8ccbcf0  edi 93491800
    07-12 21:06:46.482: I/DEBUG(106):     xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000  xss 0000007b
    07-12 21:06:46.486: I/DEBUG(106):     eip 92c0dbfd  ebp 93ec7738  esp 93ec7730  flags 00210286

    07-12 21:06:46.926: W/ActivityManager(322): Exception thrown during pause
    07-12 21:06:46.926: W/ActivityManager(322): android.os.DeadObjectException
    07-12 21:06:46.926: W/ActivityManager(322):     at android.os.BinderProxy.transact(Native Method)
    07-12 21:06:46.926: W/ActivityManager(322):     at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:635)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:990)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:3834)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:3766)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:8344)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:8221)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:8900)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:8455)
    07-12 21:06:46.926: W/ActivityManager(322):     at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)

Viewing all articles
Browse latest Browse all 58056

Trending Articles