-
Notifications
You must be signed in to change notification settings - Fork 750
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
ReactiveUI binding crash Xamarin.Android #1129
Comments
This error seems to be related to android 9.0. It doesn't seem to happen with 8.1. |
We also have experienced this error and have had to refactor our code to use non-reactive approaches with Native Android Xamarin/Mono using .NetStandard. It fails at runtime and caused us delays in our release cycles. |
I've also created a Xamarin project solution that demonstrates the bug |
It also appears the ValueTuple is a red herring and it was the upgrade to Andoid 9 for rxui that caused the binding to break. |
@glennawatson I have tested it on Android 8, 8.1 and 9 and every version has this issue. |
I'm not experienced with .NET at this depth. Could you create a test case that fails on a desktop runtime? |
@akarnokd Only happens on xamarin android runtime. Works fine on other platforms |
It seems there's a creation of an observable from an event pattern, and the event handler delegate doesn't match the actual method signature of the method to wrap. If the method to create a delegate from is EditText.Text and ReactiveUI tries to get the right method from the Anyway, if ReactiveUI finds the wrong delegate for a given property expression, it's more probably due to a change in the Xamarin bindings vs. a change in Android. But there doesn't seem to be a change either. |
@danielcweber That's as far as I've been able to gather. I will see if I can get closer to which method it is attempting to use. |
Any update on this issue? |
I got the same issue here on Xamarin.Android.
I tried to debug and I the exception is thrown here: If I checked this two var:
Then, if we check the condition:
=> target is not null
So argLenghtMatch would be false and exception will be throw. But I see few lines down this comment:
If this code was executed, argLengthMatch will be true and no exception will be throw. What about a code that seems like this, is this a possible solution ?
Is this an issue of Xamarin teams ? (File: System.Delegate.cs) |
No reply from anyone? :( |
Do we have someone from Rx.NET or ReactiveUI looking into this? :( |
I don't know. For now, to use the latest version of ReactiveUI on iOS and Android, I use it in this way on Android: For example, for this (that crash):
I changed it to:
And for the "binding" Editext => ViewModel property, I add this in onCreate function:
and this in onDestroy function:
For you information, here the function "EditText_TextChanged':
OR If you don't have to use the two way binding (Bind), using the OneWayBind doesn't crash:
|
That will be very costly for us to do, as the size of the project is too big now. :( |
Is the We discussed that there could be something outside of ReactiveUI and/or Reactive Extensions that might have caused this bug. The upgrade of ReactiveUI also required an upgrade of a lot of dependencies, so isolation was difficult. @LewisGauss I apologize for the lack of activity on this issue, things have been hectic the last few months for me. While I understand the frustration of having to wait, we have not been able to pinpoint any change in Reactive Extensions or ReactiveUI that would have caused this problem. |
@RLittlesII I'll check that and let know ASAP ;) |
Hi @RLittlesII & @Lapinou42 Would this help? According to the stack trace, it's at System.Reactive.Reflection.Utils.CreateDelegate, then it crashes at System.Delegate.CreateDelegate |
@glennawatson was able to resolve this issue. via reactiveui/ReactiveUI#2390 Closing this issue. |
@glennawatson @RLittlesII great job, tks a lot for this tricky one! |
Fantastic, I just updated, and this bug is missing! |
Bug
Despite our best efforts, bugs can slip into releases or corner cases forgotten about. We will try our best to remedy the situation
and/or provide workarounds. Note that certain (odd) behaviors are by design and as such are not considered bugs.
Was reported against 4.1.6, still present in 4.3.2
Xamarin.Android
In ReacitveUI we use Reflection and Tuples to provide Two Way Binding to UI elements. It seems that the reflection spits a specific error now when it tries to bind on Xamarin.Android. The issue was reported after we migrated to Value Tuples.
This is related to reactiveui/ReactiveUI#2170
That the bindings are found and Android handles the Two Way binding.
The following error is produced. The Android App crashes.
https://gist.github.com/RLittlesII/13c15d8047ae906aee0ad585c097f0f2
reactiveui.2170.zip
The text was updated successfully, but these errors were encountered: