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

Bug with toolbar on android MvvmCross 5.2.1 and Forms 2.4.0.282 #2252

Closed
1 of 4 tasks
JTOne123 opened this issue Oct 6, 2017 · 5 comments
Closed
1 of 4 tasks

Bug with toolbar on android MvvmCross 5.2.1 and Forms 2.4.0.282 #2252

JTOne123 opened this issue Oct 6, 2017 · 5 comments
Labels
p/android Android platform p/forms Xamarin.Forms platform t/bug Bug type
Milestone

Comments

@JTOne123
Copy link
Contributor

JTOne123 commented Oct 6, 2017

To help us fix your issue, please provide the information in the below template.

Note: There is often little we can do without a minimal reproducible sample of the issue, so please provide that in a standalone git repository and link it here.

Please only file bugs verified on latest version of MvvmCross and stable Xamarin tools

Steps to reproduce

  1. Create mvvmcross + forms project based on latest sources of both

  2. And toolbar item with an icon (without the icon everything is ok)

  3. Android should be AppCompact (based on MvxFormsAppCompatActivity)

Here's example
https://github.com/JTOne123/XamFormsMvxTemplate/blob/mvvmAndoridIconToolbarBug/MvxForms.sln

Page with toolbar
https://github.com/JTOne123/XamFormsMvxTemplate/blob/mvvmAndoridIconToolbarBug/MvxForms/MvxForms.Core/Pages/MainPage.xaml

Expected behavior

Tell us what should happen

No crash

Actual behavior

Tell us what happens instead

I have got a crash with next stack trace:

10-06 14:40:58.898 I/MonoDroid(23252): UNHANDLED EXCEPTION:
10-06 14:40:58.962 I/MonoDroid(23252): System.NullReferenceException: Object reference not set to an instance of an object.
10-06 14:40:58.962 I/MonoDroid(23252): at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00017] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:202
10-06 14:40:58.962 I/MonoDroid(23252): at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0000e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\PlatformRenderer.cs:73
10-06 14:40:58.962 I/MonoDroid(23252): at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00008] in :0
10-06 14:40:58.962 I/MonoDroid(23252): at (wrapper dynamic-method) System.Object:e6a8147a-75b0-4462-83a1-9b65d9b31f89 (intptr,intptr,bool,int,int,int,int)

PS: If revert back xamarin.forms to 2.3.4, the crash will be disappeared, but the icon is hidden anyway.

Configuration

Version: 5.2.1

Platform:

  • iOS
  • Android
  • WPF
  • UWP
@Cheesebaron Cheesebaron added the p/forms Xamarin.Forms platform label Oct 7, 2017
@Cheesebaron
Copy link
Member

And this works in an Forms App without MvvmCross?

@JTOne123
Copy link
Contributor Author

JTOne123 commented Oct 7, 2017

Yes, sure

@Yves-Be
Copy link

Yves-Be commented Oct 9, 2017

I seem to be bumping into the same issue.
Everything is fine in a new Xamarin forms solution, but the Android app crashes after adding MvvmCross.
Removing any icon from the toolbar allows the app to run again.

@JTOne123
Copy link
Contributor Author

JTOne123 commented Oct 9, 2017

My best guess is mvx touching some android object directly but should do it via appcompat wrapper.

I added this file to my proj and use it https://github.com/MvvmCross/MvvmCross/blob/8dd5707ebd8d2158cf0e5197060295bad4ba7f36/MvvmCross-Forms/MvvmCross.Forms.Droid/MvxFormsAppCompatActivity.cs

The exception has disappeared but toolbar icons are invisible until navigating to another page.

@martijn00 martijn00 added this to the 5.4.0 milestone Oct 30, 2017
@martijn00
Copy link
Contributor

Fixed in #2305

@Cheesebaron Cheesebaron added p/android Android platform t/bug Bug type labels Oct 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/android Android platform p/forms Xamarin.Forms platform t/bug Bug type
Development

No branches or pull requests

4 participants