Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic RecyclerView.Adapter crashes #1189

Closed
ctrl-shift opened this issue Jan 12, 2018 · 6 comments
Closed

Generic RecyclerView.Adapter crashes #1189

ctrl-shift opened this issue Jan 12, 2018 · 6 comments
Labels
need-info Issues that need more information from the author.

Comments

@ctrl-shift
Copy link

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

@jonpryor
Copy link
Member

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.

@jonpryor jonpryor added the need-info Issues that need more information from the author. label Jan 12, 2018
@erikpowa
Copy link
Contributor

erikpowa commented Jan 13, 2018

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
Copy link
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
Copy link
Contributor

erikpowa commented Jan 15, 2018

@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
Copy link
Author

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

@jonpryor
Copy link
Member

Closing.

jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Apr 21, 2021
Changes: xamarin/monodroid@45abd3f...ed584c7

  * xamarin/monodroid@ed584c775: [tools/msbuild] Improve FastDeploy error messages (dotnet#1190)
  * xamarin/monodroid@74294dca0: Bump to xamarin/androidtools@47ec118f (dotnet#1195)
  * xamarin/monodroid@ff633623e: [tools/msbuild] Add additional diagnostic logging for FastDev. (dotnet#1194)
  * xamarin/monodroid@546d5fb58: [tools/msbuild] Add Better Diagnostic Logging for Fast Deployment. (dotnet#1185)
  * xamarin/monodroid@fa6a1a058: [tools/msbuild] incude PackageName in MAX_COMMAND adb check. (dotnet#1189)
  * xamarin/monodroid@ac447cb5d: Bump Xamarin.Android to bring in JDK Fixes (dotnet#1192)
jonpryor pushed a commit that referenced this issue Apr 22, 2021
Fixes: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1301607

Context: #5710
Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1290661

Changes: xamarin/monodroid@45abd3f...ff63362

  * xamarin/monodroid@ff633623e: [tools/msbuild] Add additional diagnostic logging for FastDev. (#1194)
  * xamarin/monodroid@546d5fb58: [tools/msbuild] Add Better Diagnostic Logging for Fast Deployment. (#1185)
  * xamarin/monodroid@fa6a1a058: [tools/msbuild] incude PackageName in MAX_COMMAND adb check. (#1189)
  * xamarin/monodroid@ac447cb5d: Bump Xamarin.Android to bring in JDK Fixes (#1192)

Issue #5710 was an error in Fast Deployment when an app had "lots" of
localization assemblies, causing an `adb shell` command to become
"too long".  This was fixed in xamarin/monodroid@3a05726b and d9ed129.

Add a new unit test which contains *all* available languages, as
returned by `CultureInfo.GetCultures(CultureTypes.AllCultures)`
(possibly 342 of them!).

(This new test found that there were additional issues around
Fast Deployment and "lots" of localization assemblies, addressed in
xamarin/monodroid@fa6a1a058.)
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need-info Issues that need more information from the author.
Projects
None yet
Development

No branches or pull requests

3 participants