From android device log:
Time Device Name Type PID Tag Message
05-24 11:51:53.360 HMD Global Nokia 7 plus Info 26315 MonoDroid System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
05-24 11:51:53.359 HMD Global Nokia 7 plus Info 26315 MonoDroid UNHANDLED EXCEPTION:
05-24 11:51:53.357 HMD Global Nokia 7 plus Warning 26315 .umoe.mef.droi JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
05-24 11:51:53.356 HMD Global Nokia 7 plus Info 26315 mono-stdout Parameter name: sourceEventInfo
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4fba98 + 0x00168> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4fba38 + 0x0004b> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidTargetEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4d4b94 + 0x00013> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidWeakSubscriptionExtensions.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) <0x738b4d4f30 + 0x00043> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerViewHolder.OnAttachedToWindow () <0x738b14b8e8 + 0x00147> in <616f88ccaa3346d5a6d2828535fb97d2>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerAdapter.OnViewAttachedToWindow (Java.Lang.Object holder) <0x738b149c44 + 0x0008b> in <616f88ccaa3346d5a6d2828535fb97d2>:0
at Android.Support.V7.Widget.RecyclerView+Adapter.n_OnViewAttachedToWindow_Landroid_support_v7_widget_RecyclerView_ViewHolder_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_holder) <0x738b0d2da4 + 0x00047> in <6eed09e4efb34b9fac8e6e51402ef112>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.34(intptr,intptr,intptr)
05-24 11:51:53.356 HMD Global Nokia 7 plus Info 26315 mono-stdout missing source event info in MvxWeakEventSubscription
05-24 11:51:53.356 HMD Global Nokia 7 plus Info 26315 mono-stdout System.ArgumentNullException
05-24 11:51:53.356 HMD Global Nokia 7 plus Info 26315 mono-stdout 2019-05-24 11:51:53 [ERROR] (Andorid Application) Unhandled exception on UI thread
05-24 11:51:53.354 HMD Global Nokia 7 plus Info 26315 MonoDroid Parameter name: sourceEventInfo
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4fba98 + 0x00168> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4fba38 + 0x0004b> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidTargetEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) <0x738b4d4b94 + 0x00013> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidWeakSubscriptionExtensions.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) <0x738b4d4f30 + 0x00043> in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerViewHolder.OnAttachedToWindow () <0x738b14b8e8 + 0x00147> in <616f88ccaa3346d5a6d2828535fb97d2>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerAdapter.OnViewAttachedToWindow (Java.Lang.Object holder) <0x738b149c44 + 0x0008b> in <616f88ccaa3346d5a6d2828535fb97d2>:0
at Android.Support.V7.Widget.RecyclerView+Adapter.n_OnViewAttachedToWindow_Landroid_support_v7_widget_RecyclerView_ViewHolder_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_holder) <0x738b0d2da4 + 0x00047> in <6eed09e4efb34b9fac8e6e51402ef112>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.34(intptr,intptr,intptr)
05-24 11:51:53.354 HMD Global Nokia 7 plus Info 26315 MonoDroid System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
Version: 6.3
Platform:
You could try adding something like this to your LinkerPleaseInclude file:
void Include(IMvxRecyclerViewHolder viewHolder)
{
void OnItemViewClick(object sender, EventArgs e) { }
void OnItemViewLongClick(object sender, EventArgs e) { }
viewHolder.Click -= OnItemViewClick;
viewHolder.LongClick -= OnItemViewLongClick;
viewHolder.Click += OnItemViewClick;
viewHolder.LongClick += OnItemViewLongClick;
}
Told you @Cheesebaron to let me put the linker code directly in the class, now that it's easy to do, instead of this old fashioned linkerplzinclude.
@softlion your comment doesn't help. That work should be done as part of a bigger linker safety overhaul.
Unfortunately, that didn't seem to solve the problem (I've tried a bunch of things in LinkerPleaseInclude, but I'm kinda lost here).
Managed to find the following in logcat:
Time Device Name Type PID Tag Message
05-27 09:06:12.327 HMD Global Nokia 7 plus Info 24026 mono-stdout
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <f9e68ddf9cd44f5f9b04483b4723498f>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <f9e68ddf9cd44f5f9b04483b4723498f>:0
at Android.Support.V7.Widget.RecyclerView+LayoutManager.OnLayoutChildren (Android.Support.V7.Widget.RecyclerView+Recycler recycler, Android.Support.V7.Widget.RecyclerView+State state) [0x00053] in <8179286ab006428a9addc7162f9c18e1>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxGuardedLinearLayoutManager.OnLayoutChildren (Android.Support.V7.Widget.RecyclerView+Recycler recycler, Android.Support.V7.Widget.RecyclerView+State state) [0x00000] in <616f88ccaa3346d5a6d2828535fb97d2>:0
at Android.Support.V7.Widget.RecyclerView+LayoutManager.n_OnLayoutChildren_Landroid_support_v7_widget_RecyclerView_Recycler_Landroid_support_v7_widget_RecyclerView_State_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_recycler, System.IntPtr native_state) [0x00017] in <8179286ab006428a9addc7162f9c18e1>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr,intptr,intptr)
Time Device Name Type PID Tag Message
05-27 09:06:12.321 HMD Global Nokia 7 plus Error 24026 AndroidRuntime
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <f9e68ddf9cd44f5f9b04483b4723498f>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <f9e68ddf9cd44f5f9b04483b4723498f>:0
at Android.Support.V7.Widget.RecyclerView+LayoutManager.OnLayoutChildren (Android.Support.V7.Widget.RecyclerView+Recycler recycler, Android.Support.V7.Widget.RecyclerView+State state) [0x00053] in <8179286ab006428a9addc7162f9c18e1>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxGuardedLinearLayoutManager.OnLayoutChildren (Android.Support.V7.Widget.RecyclerView+Recycler recycler, Android.Support.V7.Widget.RecyclerView+State state) [0x00000] in <616f88ccaa3346d5a6d2828535fb97d2>:0
at Android.Support.V7.Widget.RecyclerView+LayoutManager.n_OnLayoutChildren_Landroid_support_v7_widget_RecyclerView_Recycler_Landroid_support_v7_widget_RecyclerView_State_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_recycler, System.IntPtr native_state) [0x00017] in <8179286ab006428a9addc7162f9c18e1>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr,intptr,intptr)
at mvvmcross.droid.support.v7.recyclerview.MvxGuardedLinearLayoutManager.n_onLayoutChildren(Native Method)
at mvvmcross.droid.support.v7.recyclerview.MvxGuardedLinearLayoutManager.onLayoutChildren(MvxGuardedLinearLayoutManager.java:54)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:4194)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:508)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:903)
at android.view.View.layout(View.java:20715)
at android.view.ViewGroup.layout(ViewGroup.java:6202)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2802)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2329)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1469)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7209)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1050)
at android.view.Choreographer.doCallbacks(Choreographer.java:862)
at android.view.Choreographer.doFrame(Choreographer.java:797)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1036)
at android.os.Handler.handleCallback(Handler.java:874)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Time Device Name Type PID Tag Message
05-27 09:06:12.321 HMD Global Nokia 7 plus Error 24026 AndroidRuntime Parameter name: sourceEventInfo
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) [0x0001d] in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00012] in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidTargetEventSubscription`2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00000] in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidWeakSubscriptionExtensions.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) [0x00000] in <d4f0f9c16e25440aaf673bb2434bc101>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerViewHolder.OnAttachedToWindow () [0x00074] in <616f88ccaa3346d5a6d2828535fb97d2>:0
at MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerAdapter.OnViewAttachedToWindow (Java.Lang.Object holder) [0x00007] in <616f88ccaa3346d5a6d2828535fb97d2>:0
at Android.Support.V7.Widget.RecyclerView+Adapter.n_OnViewAttachedToWindow_Landroid_support_v7_widget_RecyclerView_ViewHolder_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_holder) [0x0000f] in <8179286ab006428a9addc7162f9c18e1>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.34(intptr,intptr,intptr)
What do you actually have in your LinkerPleaseInclude?
Sadly exact the same situation here.
I'm currently playing around with LinkerPleaseInclude, but were not able to solve it until now.
public void Include(Button button)
{
button.Click += (s, e) => button.Text = button.Text + "";
}
public void Include(CheckBox checkBox)
{
checkBox.CheckedChange += (sender, args) => checkBox.Checked = !checkBox.Checked;
}
public void Include(Switch @switch)
{
@switch.CheckedChange += (sender, args) => @switch.Checked = [email protected];
}
public void Include(View view)
{
view.Click += (s, e) => view.ContentDescription = view.ContentDescription + "";
}
public void Include(TextView text)
{
text.AfterTextChanged += (sender, args) => text.Text = "" + text.Text;
text.Hint = "" + text.Hint;
}
public void Include(CheckedTextView text)
{
text.AfterTextChanged += (sender, args) => text.Text = "" + text.Text;
text.Hint = "" + text.Hint;
}
public void Include(CompoundButton cb)
{
cb.CheckedChange += (sender, args) => cb.Checked = !cb.Checked;
}
public void Include(SeekBar sb)
{
sb.ProgressChanged += (sender, args) => sb.Progress = sb.Progress + 1;
}
public void Include(RadioGroup radioGroup)
{
radioGroup.CheckedChange += (sender, args) => radioGroup.Check(args.CheckedId);
}
public void Include(RadioButton radioButton)
{
radioButton.CheckedChange += (sender, args) => radioButton.Checked = args.IsChecked;
}
public void Include(RatingBar ratingBar)
{
ratingBar.RatingBarChange += (sender, args) => ratingBar.Rating = 0 + ratingBar.Rating;
}
public void Include(Activity act)
{
act.Title = act.Title + "";
}
public void Include(INotifyCollectionChanged changed)
{
changed.CollectionChanged += (s, e) => { var test = $"{e.Action}{e.NewItems}{e.NewStartingIndex}{e.OldItems}{e.OldStartingIndex}"; };
}
public void Include(ICommand command)
{
command.CanExecuteChanged += (s, e) => { if (command.CanExecute(null)) command.Execute(null); };
}
public void Include(MvxPropertyInjector injector)
{
injector = new MvxPropertyInjector();
}
public void Include(System.ComponentModel.INotifyPropertyChanged changed)
{
changed.PropertyChanged += (sender, e) =>
{
var test = e.PropertyName;
};
}
public void Include(MvxTaskBasedBindingContext context)
{
context.Dispose();
var context2 = new MvxTaskBasedBindingContext();
context2.Dispose();
}
public void Include(MvxNavigationService service, IMvxViewModelLoader loader)
{
service = new MvxNavigationService(null, loader);
}
public void Include(ConsoleColor color)
{
//Console.Write("");
//Console.WriteLine("");
//color = Console.ForegroundColor;
//Console.ForegroundColor = ConsoleColor.Red;
//Console.ForegroundColor = ConsoleColor.Yellow;
//Console.ForegroundColor = ConsoleColor.Magenta;
//Console.ForegroundColor = ConsoleColor.White;
//Console.ForegroundColor = ConsoleColor.Gray;
//Console.ForegroundColor = ConsoleColor.DarkGray;
}
public void Include(PreferencesImplementation preferences)
{
preferences = new PreferencesImplementation();
}
public void Include(Serilog.ILogger logger)
{
Serilog.Events.LogEventLevel logEventLevel = Serilog.Events.LogEventLevel.Debug;
_ = Serilog.Log.ForContext("", "", false);
_ = Serilog.Context.LogContext.PushProperty("", "", false);
_ = !logger.IsEnabled(logEventLevel);
logger.Write(logEventLevel, "", new object[0]);
logger.Write(logEventLevel, new Exception(), "", new object[0]);
}
public void Include(IMvxRecyclerViewHolder viewHolder)
{
void OnItemViewClick(object sender, EventArgs e) { }
void OnItemViewLongClick(object sender, EventArgs e) { }
viewHolder.Click -= OnItemViewClick;
viewHolder.LongClick -= OnItemViewLongClick;
viewHolder.Click += OnItemViewClick;
viewHolder.LongClick += OnItemViewLongClick;
}
public void Include(MvxRecyclerViewHolder viewHolder)
{
void OnItemViewClick(object sender, EventArgs e) { }
void OnItemViewLongClick(object sender, EventArgs e) { }
viewHolder.Click -= OnItemViewClick;
viewHolder.LongClick -= OnItemViewLongClick;
viewHolder.Click += OnItemViewClick;
viewHolder.LongClick += OnItemViewLongClick;
}
This is the lines that @Cheesebaron didn't want to include because "it have to be done globally". I don't agree with him but it is his choice. I prefer to test things first at one place, and if they work spread them globally.
These lines should fix your issue. Currently working OK on 1 real project.
public void Include(RecyclerView.ViewHolder vh, MvxRecyclerView list)
{
vh.ItemView.Click += (sender, args) => { };
vh.ItemView.LongClick += (sender, args) => { };
list.ItemsSource = null;
list.Click += (sender, args) => { };
}
That appeared to work, thank you!
@softlion Thx for that, its working.
But to be honest, how does you find out such things?
Its easy. When it crashes there is a message "missing method xxxx" or "missing property xxxx".
Most helpful comment
This is the lines that @Cheesebaron didn't want to include because "it have to be done globally". I don't agree with him but it is his choice. I prefer to test things first at one place, and if they work spread them globally.
These lines should fix your issue. Currently working OK on 1 real project.