- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 MVVMCross 4.1.6(也在 4.1.4 上尝试过)并且在可观察集合中的项目属性方面存在问题。当我在我的 2 个选项卡之间反复切换时会发生这种情况,每个选项卡都有一个 MvxRecyclerView 和一个连接在一起的项目列表。基本上一个是普通列表,一个是收藏列表。
当通过此方法显示 fragment 时,这两个列表都由后台数据准备,以确保显示所有新数据:
private void updateChannels()
{
foreach (var category in CalCategories)
{
if (string.IsNullOrEmpty(m_searchString))
{
var channels = category.Channels.Where(o => o.Task == null).ToList();
if (category.Count != channels.Count)
{
category.Count = channels.Count;
}
if (channels.Count > 0)
{
if (!CalChannelList.Contains(category))
{
CalChannelList.Add(category);
}
if (category.Expanded)
{
foreach (var channel in channels)
{
if (!CalChannelList.Contains(channel))
{
CalChannelList.Add(channel);
}
}
}
}
}
else
{
var channels = category.Channels.Where(o => o.Name.Contains(SearchString) && o.Task == null).ToList();
if (category.Count != channels.Count)
{
category.Count = channels.Count;
}
if (channels.Count > 0)
{
if (!CalChannelList.Contains(category))
{
CalChannelList.Add(category);
}
if (category.Expanded)
{
foreach (var channel in channels)
{
if (!CalChannelList.Contains(channel))
{
CalChannelList.Add(channel);
}
}
}
}
}
}
}
在选项卡之间来回切换一定时间后会出现错误,并且总是在设置 category.Count 时发生在该行。
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) object.wrapper_native_0xb4ecb6f9 (intptr,intptr,intptr,Android.Runtime.JValue*) <IL 0x0002a, 0xffffffff>
at (wrapper delegate-invoke) <Module>.invoke_void_intptr_intptr_intptr_JValue* (intptr,intptr,intptr,Android.Runtime.JValue*) <IL 0x0007d, 0xffffffff>
at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00040] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:567
at Android.Widget.TextView.set_TextFormatted (Java.Lang.ICharSequence) [0x0004b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.TextView.cs:3237
at Android.Widget.TextView.set_Text (string) [0x00013] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.TextView.cs:3248
at MvvmCross.Binding.Droid.Target.MvxTextViewTextTargetBinding.SetValueImpl (object,object) <IL 0x0000c, 0x000ab>
at MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue (object) [0x00088] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Target\MvxConvertingTargetBinding.cs:61
at MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (object) [0x00024] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:156
at MvvmCross.Binding.Bindings.MvxFullBinding.<CreateSourceBinding>b__15_0 (object,System.EventArgs) [0x0000c] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:85
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxPathSourceStep.SourceBindingOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxPathSourceStep.cs:71
at MvvmCross.Binding.Bindings.Source.MvxSourceBinding.FireChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\MvxSourceBinding.cs:36
at MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.OnBoundPropertyChanged () [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\Leaf\MvxLeafPropertyInfoSourceBinding.cs:29
at MvvmCross.Binding.Bindings.Source.MvxPropertyInfoSourceBinding.SourcePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00020] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\MvxPropertyInfoSourceBinding.cs:88
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x00062, 0xffffffff>
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <IL 0x00034, 0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00038] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/reflection/methodbase.cs:277
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2<TKey_REF, TValue_REF>.OnSourceEvent (object,TValue_REF) [0x0000f] in D:\git\MvvmCross\MvvmCross\Platform\Platform\WeakSubscription\MvxWeakEventSubscription.cs:75
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00074, 0xffffffff>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged/<>c__DisplayClass10_0.<RaisePropertyChanged>b__0 () <IL 0x0001c, 0x000a7>
at MvvmCross.Droid.Views.MvxAndroidMainThreadDispatcher.RequestMainThreadAction (System.Action) <IL 0x0001f, 0x00133>
at MvvmCross.Platform.Core.MvxMainThreadDispatchingObject.InvokeOnMainThread (System.Action) [0x00000] in D:\git\MvvmCross\MvvmCross\Platform\Platform\Core\MvxMainThreadDispatchingObject.cs:18
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged (System.ComponentModel.PropertyChangedEventArgs) <IL 0x00044, 0x00277>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged (string) <IL 0x00009, 0x000b3>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.SetProperty<int> (int&,int,string) <IL 0x00023, 0x00147>
at XCPCore.Models.BaseCategory.set_Count (int) [0x00001] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\Models\BaseCategory.cs:26
at XCPCore.ViewModels.Cal.CalFavoritesViewModel.updateChannels () [0x00075] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\ViewModels\Cal\CalFavoritesViewModel.cs:135
at XCPCore.ViewModels.Cal.CalFavoritesViewModel.Refresh () [0x00001] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\ViewModels\Cal\CalFavoritesViewModel.cs:180
at MobileXcp.XcpAndroidApp.Fragments.CalFavoritesFragment.set_UserVisibleHint (bool) [0x0000a] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpAndroidApp\Fragments\CalFavoritesFragment.cs:82
at Android.Support.V4.App.Fragment.n_SetUserVisibleHint_Z (intptr,intptr,bool) <IL 0x0000b, 0x000b7>
at (wrapper dynamic-method) object.7467b8b6-907d-4849-8505-c72161c45779 (intptr,intptr,bool) <IL 0x00017, 0x00043>
at (wrapper native-to-managed) object.7467b8b6-907d-4849-8505-c72161c45779 (intptr,intptr,int) <IL 0x0002f, 0xffffffff>
Attempting native Android stacktrace:
at ???+3035307817 [0x6fe827f8]
at ???+3035307817 [0xffffffff]
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Fatal signal 7 (SIGBUS), code 1, fault addr 0x5 in tid 7646 (leXcp.MobileXcp)
另一个堆栈跟踪,发生在更改 SearchView 以及整个列表时:
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) object.wrapper_native_0xb4ecb6f9 (intptr,intptr,intptr,Android.Runtime.JValue*) <IL 0x0002a, 0xffffffff>
at (wrapper delegate-invoke) <Module>.invoke_void_intptr_intptr_intptr_JValue* (intptr,intptr,intptr,Android.Runtime.JValue*) <IL 0x0007d, 0xffffffff>
at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00040] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:567
at Android.Widget.TextView.set_TextFormatted (Java.Lang.ICharSequence) [0x0004b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.TextView.cs:3237
at Android.Widget.TextView.set_Text (string) [0x00013] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.TextView.cs:3248
at MvvmCross.Binding.Droid.Target.MvxTextViewTextTargetBinding.SetValueImpl (object,object) <IL 0x0000c, 0x000ab>
at MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue (object) [0x00088] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Target\MvxConvertingTargetBinding.cs:61
at MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (object) [0x00024] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:156
at MvvmCross.Binding.Bindings.MvxFullBinding.<CreateSourceBinding>b__15_0 (object,System.EventArgs) [0x0000c] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:85
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxCombinerSourceStep.SubStepOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxCombinerSourceStep.cs:107
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SendSourcePropertyChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:119
at MvvmCross.Binding.Bindings.SourceSteps.MvxPathSourceStep.SourceBindingOnChanged (object,System.EventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxPathSourceStep.cs:71
at MvvmCross.Binding.Bindings.Source.MvxSourceBinding.FireChanged () [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\MvxSourceBinding.cs:36
at MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.OnBoundPropertyChanged () [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\Leaf\MvxLeafPropertyInfoSourceBinding.cs:29
at MvvmCross.Binding.Bindings.Source.MvxPropertyInfoSourceBinding.SourcePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00020] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\MvxPropertyInfoSourceBinding.cs:88
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x00062, 0xffffffff>
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <IL 0x00034, 0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00038] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/reflection/methodbase.cs:277
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2<TKey_REF, TValue_REF>.OnSourceEvent (object,TValue_REF) [0x0000f] in D:\git\MvvmCross\MvvmCross\Platform\Platform\WeakSubscription\MvxWeakEventSubscription.cs:75
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00074, 0xffffffff>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged/<>c__DisplayClass10_0.<RaisePropertyChanged>b__0 () <IL 0x0001c, 0x000a7>
at MvvmCross.Droid.Views.MvxAndroidMainThreadDispatcher.RequestMainThreadAction (System.Action) <IL 0x0001f, 0x00133>
at MvvmCross.Platform.Core.MvxMainThreadDispatchingObject.InvokeOnMainThread (System.Action) [0x00000] in D:\git\MvvmCross\MvvmCross\Platform\Platform\Core\MvxMainThreadDispatchingObject.cs:18
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged (System.ComponentModel.PropertyChangedEventArgs) <IL 0x00044, 0x00277>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged (string) <IL 0x00009, 0x000b3>
at MvvmCross.Core.ViewModels.MvxNotifyPropertyChanged.SetProperty<int> (int&,int,string) <IL 0x00023, 0x00147>
at XCPCore.Models.BaseCategory.set_Count (int) [0x00001] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\Models\BaseCategory.cs:36
at XCPCore.ViewModels.Meas.ConfigInViewModel.updateChannels () [0x00149] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\ViewModels\Meas\ConfigInViewModel.cs:209
at XCPCore.ViewModels.Meas.ConfigInViewModel.set_SearchString (string) [0x00043] in w:\DevWA\MobileXCP~BARONDST\MobileXCP\MobileXcp\MobileXcp.XcpCore\ViewModels\Meas\ConfigInViewModel.cs:158
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x0005a, 0xffffffff>
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <IL 0x00034, 0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00038] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
at System.Reflection.MonoProperty.SetValue (object,object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x0006a] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:445
at System.Reflection.PropertyInfo.SetValue (object,object,object[]) [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/mcs/class/corlib/System.Reflection/PropertyInfo.cs:111
at MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.SetValue (object) [0x00060] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Source\Leaf\MvxLeafPropertyInfoSourceBinding.cs:83
at MvvmCross.Binding.Bindings.SourceSteps.MvxPathSourceStep.SetSourceValue (object) [0x0001b] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxPathSourceStep.cs:85
at MvvmCross.Binding.Bindings.SourceSteps.MvxSourceStep.SetValue (object) [0x0001a] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\SourceSteps\MvxSourceStep.cs:70
at MvvmCross.Binding.Bindings.MvxFullBinding.UpdateSourceFromTarget (object) [0x00013] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:179
at MvvmCross.Binding.Bindings.MvxFullBinding.<CreateTargetBinding>b__18_0 (object,MvvmCross.Binding.Bindings.Target.MvxTargetChangedEventArgs) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:140
at MvvmCross.Binding.Bindings.Target.MvxTargetBinding.FireValueChanged (object) [0x00006] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Target\MvxTargetBinding.cs:32
at MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.FireValueChanged (object) [0x0003f] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\Target\MvxConvertingTargetBinding.cs:93
at MvvmCross.Binding.Droid.Target.MvxSearchViewQueryTextTargetBinding.HandleQueryTextChanged (object,Android.Widget.SearchView/QueryTextChangeEventArgs) <IL 0x00019, 0x0014f>
at Android.Widget.SearchView/IOnQueryTextListenerImplementor.OnQueryTextChange (string) [0x00017] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.SearchView.cs:322
at Android.Widget.SearchView/IOnQueryTextListenerInvoker.n_OnQueryTextChange_Ljava_lang_String_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.SearchView.cs:207
at (wrapper dynamic-method) object.bf5df6e6-8c4e-4c9b-b90b-f3b9d377de80 (intptr,intptr,intptr) <IL 0x00017, 0x0004b>
at (wrapper native-to-managed) object.bf5df6e6-8c4e-4c9b-b90b-f3b9d377de80 (intptr,intptr,intptr) <IL 0x00029, 0xffffffff>
Attempting native Android stacktrace:
at ???+0 [0x6fe827f8]
at ???+0 [0x3f7ffffc]
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
06-02 12:24:13.942 E/mono-rt ( 6344):
更新
似乎与绑定(bind)和更新 ui 元素有关。也许当某个项目被删除时,元素的引用会以某种方式被清除或未完全释放?至少在没有 MvxBindings 的情况下,在此过程中它不会崩溃。
更新 2
public abstract class BaseCategory : MvxNotifyPropertyChanged, IChannelItem
{
public bool Expanded { get; set; }
public int FavoriteCount
{
get { return m_iFavoriteCount; }
set { SetProperty(ref m_iFavoriteCount, value); }
}
public int Count
{
get
{
return m_iCount;
}
set
{
SetProperty(ref m_iCount, value);
}
}
public string Name { get; set; }
protected BaseCategory(string sName)
{
Expanded = false;
Count = 0;
FavoriteCount = 0;
Name = sName;
}
private int m_iCount;
private int m_iFavoriteCount;
public ChannelItemTypes CItemType { get { return ChannelItemTypes.Category; } }
}
以及选择我的 multititemtemplateselector 的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
xmlns:cardview="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:foreground="?attr/selectableItemBackground"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
cardview:cardUseCompatPadding="true"
cardview:cardCornerRadius="2dp"
cardview:cardElevation="2dp"
cardview:contentPadding="10dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_horizontal"
android:layout_marginRight="5dp"
android:padding="10dp"
android:textColor="@color/white"
android:textStyle="bold"
local:MvxBind="Text (Name+' '+Count)" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
更新 3显然 updateChannels() 方法创建了越来越多的数据对象。我只是不确定可能是什么原因造成的?绑定(bind)到 UI 元素,LinQ 命令?还是我只是瞎了眼?
更新 4我现在创建了一个单独的项目,在 fragment 中只有一个 MvxRecyclerView 和一个 ObservableCollection。如果我单击按钮,我会在清除列表后将 X 个新对象添加到列表中。通过使用 DeviceMonitor 观察它,对象不断增加,所以要么我做错了什么,要么我使用的组件有问题。
https://github.com/Noires/MvxRecyclerViewLeakTest
更新 5虽然这是一个问题,但它与原始问题无关。所以目前我只是自己更改了 MVVMCross 以防止它发生,然后会检查真正的问题。
更新 6问题打开于 https://github.com/MvvmCross/MvvmCross/issues/1379
最佳答案
正如我在评论中提到的,SIGSEGV
主要与内存管理问题有关。
RecyclerView
的优点之一是您可以在不刷新整个列表的情况下添加元素。这样可以节省大量内存。
在 updateChannels
方法中,您正在清除列表(可能是 recyclerView
的来源),然后再次读取元素。这是一个非常糟糕的解决方案,尤其是对于大列表。这样整个 recyclerView
都会在您每次更改选项卡时更新,这会严重影响性能。
你应该做的是检查你是否有新数据并且只添加新元素。
为此,您可能会找到一个更好的示例,但一个简单快速的解决方案是 newList.Except(recyclerViewSourceList)
。这将为您提供来自回收站 View 不包含的新来源的元素。检查此以获取更多详细信息:https://stackoverflow.com/a/3944821/3423468
关于android - MvxNotifyPropertyChanged 应用程序在 SetProperty 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37585394/
我正在通过 labrepl 工作,我看到了一些遵循此模式的代码: ;; Pattern (apply #(apply f %&) coll) ;; Concrete example user=> (a
我从未向应用商店提交过应用,但我会在不久的将来提交。 到目前为止,我对为 iPhone 而非 iPad 进行设计感到很自在。 我了解,通过将通用PAID 应用放到应用商店,客户只需支付一次就可以同时使
我有一个应用程序,它使用不同的 Facebook 应用程序(2 个不同的 AppID)在 Facebook 上发布并显示它是“通过 iPhone”/“通过 iPad”。 当 Facebook 应用程序
我有一个要求,我们必须通过将网站源文件保存在本地 iOS 应用程序中来在 iOS 应用程序 Webview 中运行网站。 Angular 需要服务器来运行应用程序,但由于我们将文件保存在本地,我们无法
所以我有一个单页客户端应用程序。 正常流程: 应用程序 -> OAuth2 服务器 -> 应用程序 我们有自己的 OAuth2 服务器,因此人们可以登录应用程序并获取与用户实体关联的 access_t
假设我有一个安装在用户设备上的 Android 应用程序 A,我的应用程序有一个 AppWidget,我们可以让其他 Android 开发人员在其中以每次安装成本为基础发布他们的应用程序推广广告。因此
Secrets of the JavaScript Ninja中有一个例子它提供了以下代码来绕过 JavaScript 的 Math.min() 函数,该函数需要一个可变长度列表。 Example:
当我分别将数组和对象传递给 function.apply() 时,我得到 NaN 的 o/p,但是当我传递对象和数组时,我得到一个数字。为什么会发生这种情况? 由于数组也被视为对象,为什么我无法使用它
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章ASP转换格林威治时间函数DateDiff()应用由作者收集整理,如果你
我正在将列表传递给 map并且想要返回一个带有合并名称的 data.frame 对象。 例如: library(tidyverse) library(broom) mtcars %>% spl
我有一个非常基本的问题,但我不知道如何实现它:我有一个返回数据框,其中每个工具的返回值是按行排列的: tmp<-as.data.frame(t(data.frame(a=rnorm(250,0,1)
我正在使用我的 FB 应用创建群组并邀请用户加入我的应用群组,第一次一切正常。当我尝试创建另一个组时,出现以下错误: {"(OAuthException - #4009) (#4009) 在有更多用户
我们正在开发一款类似于“会说话的本”应用程序的 child 应用程序。它包含大量用于交互式动画的 JPEG 图像序列。 问题是动画在 iPad Air 上播放正常,但在 iPad 2 上播放缓慢或滞后
我关注 clojure 一段时间了,它的一些功能非常令人兴奋(持久数据结构、函数式方法、不可变状态)。然而,由于我仍在学习,我想了解如何在实际场景中应用,证明其好处,然后演化并应用于更复杂的问题。即,
我开发了一个仅使用挪威语的应用程序。该应用程序不使用本地化,因为它应该仅以一种语言(挪威语)显示。但是,我已在 Info.plist 文件中将“本地化 native 开发区域”设置为“no”。我还使用
读完 Anthony's response 后上a style-related parser question ,我试图说服自己编写单体解析器仍然可以相当紧凑。 所以而不是 reference ::
multicore 库中是否有类似 sapply 的东西?还是我必须 unlist(mclapply(..)) 才能实现这一点? 如果它不存在:推理是什么? 提前致谢,如果这是一个愚蠢的问题,我们深表
我喜欢在窗口中弹出结果,以便更容易查看和查找(例如,它们不会随着控制台继续滚动而丢失)。一种方法是使用 sink() 和 file.show()。例如: y <- rnorm(100); x <- r
我有一个如下所示的 spring mvc Controller @RequestMapping(value="/new", method=RequestMethod.POST) public Stri
我正在阅读 StructureMap关于依赖注入(inject),首先有两部分初始化映射,具体类类型的接口(interface),另一部分只是实例化(请求实例)。 第一部分需要配置和设置,这是在 Bo
我是一名优秀的程序员,十分优秀!