Skip to content

Generic RecyclerView.Adapter crashes #1189

Closed
@ctrl-shift

Description

@ctrl-shift

Xamarin android version included in latest VS Preview does not handle generic RecyclerView Adapters.
Check attached test project. Everything runs fine from current stable version of VS.

Steps to Reproduce

  1. Create generic RecyclerView.Adapter
  2. Set it as adapter to RecyclerView
  3. Observe crash on runtime without stacktrace

TestApp.zip

Expected Behavior

Everything runs fine

Actual Behavior

App crashes without output or catching exception in debug

Version Information

Microsoft Visual Studio Community 2017 Preview (2)
Version 15.6.0 Preview 2.0
VisualStudio.15.Preview/15.6.0-pre.2.0+27309.0
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Community

Activity

jonpryor

jonpryor commented on Jan 12, 2018

@jonpryor
Contributor

I am unable to reproduce a crash on a Pixel 2 running Android 8.0.

However, I do observe the following message in adb logcat:

E RecyclerView: No layout manager attached; skipping layout

If I try to search for the above, a stackoverflow response comes up, and from a quick reading of the answer I think your repro project is incomplete. For example, you don't have a <android.support.v7.widget.RecyclerView/> element within Resources\layout\Main.axml.

I also don't understand how the repro is supposed to work: Resource.Layout.Main is just a <LinearLayout/> which doesn't do anything with the RecyclerView instance created in the constructor.

I don't understand how this is supposed to work in the first place.

added
need-infoIssues that need more information from the author.
on Jan 12, 2018
erikpowa

erikpowa commented on Jan 13, 2018

@erikpowa
Contributor

I had similar issues or the same with the xamarin.android that came with the 15.6.0 Preview 2.0, maybe it was 8.1.3.0?
Here is my old repro proj App9.csproj.zip but it's fixed since then.
As I remember it's not reproducible anymore since 8.2.0.6? (sdk) version.
The exception was something like the xamarin.android tried to create and instance of an abstract "Base
Adapter" class instead of the derived.

ctrl-shift

ctrl-shift commented on Jan 15, 2018

@ctrl-shift
Author

@jonpryor This is just a simplest repro project that crashes for me on latest VS preview but not on stable.
I've got the same issue in multiple places in a rather large app.
Looked a bit more into the logs of the app, found:
F/art ( 3928): art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: can't make objects of type android.support.v7.widget.RecyclerView$Adapter: 0x12c2cc80 F/art ( 3928): art/runtime/java_vm_ext.cc:470] in call to AllocObject ...

Checked Xamarin.Android version on VS preview - it's 8.2.0.1 (HEAD/1e47e7ed5), so it might be the version with the issue @erikpowa mentioned. Is there any way to update Xamarin.Android in VS preview without waiting for whole VS update, so I can check if issue is resolved at 8.2.0.6?

erikpowa

erikpowa commented on Jan 15, 2018

@erikpowa
Contributor

@ctrl-shift jenkins. But prepare for other bugs. You can roll back (revert) whenever you want from VS Extensions.

F/art ( 3928): art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: can't make objects of type android.support.v7.widget.RecyclerView$Adapter: 0x12c2cc80 F/art ( 3928): art/runtime/java_vm_ext.cc:470] in call to AllocObject ...

@ctrl-shift Yeah, this is what I had before 8.2.0.6 so I'm pretty sure it's fixed already.

ctrl-shift

ctrl-shift commented on Jan 15, 2018

@ctrl-shift
Author

Updated to 8.2.0.6 and I can no longer reproduce this anywhere.
I suppose issue can be closed.

jonpryor

jonpryor commented on Jan 16, 2018

@jonpryor
Contributor

Closing.

added a commit that references this issue on Apr 22, 2021

Bump to xamarin/monodroid@ff633623e; fastdev ALL localizations (#5785)

ee0fe45
ghost locked as resolved and limited conversation to collaborators on Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-infoIssues that need more information from the author.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jonpryor@erikpowa@ctrl-shift

        Issue actions

          Generic RecyclerView.Adapter crashes · Issue #1189 · dotnet/android