Hi Xamaranians,


I regularly get an unhandled exception in the emulator when I instantiate a
custom ArrayAdaptor. The top level of the call stack shows:
"Mono_UnhandledException":



System.Diagnostics.Debugger.Mono_UnhandledException (Parameters=) in
/home/jon/Development/xamarin/mono/mcs/class/corlib/System.Diagnostics/Debug
ger.cs:124



The line of code is:



var adapter = new CustomisedTypefaceArrayAdapter<String>
(_registry.CustomTypeface, this, Resource.Layout.list_item, suggestions);



The stacktrace is:



I/mono    ( 8244): Stacktrace:

I/mono    ( 8244): 

I/mono    ( 8244):   at Android.Runtime.JNIEnv.NewGlobalRef (intptr)
[0x00000] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JNIEnv.cs:
336

I/mono    ( 8244):   at Java.Lang.Object.RegisterInstance
(Android.Runtime.IJavaObject,intptr,Android.Runtime.JniHandleOwnership)
[0x00041] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Java.Lang/Object.c
s:138

I/mono    ( 8244):   at Java.Lang.Object.SetHandle
(intptr,Android.Runtime.JniHandleOwnership) [0x00000] in
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Java.Lang/Object.c
s:122

I/mono    ( 8244):   at Java.Lang.String..ctor (string) [0x000a7] in
/Users/jon/Development/xamarin/monodroid/Mono.Android/platforms/android-7/sr
c/generated/Java.Lang.String.cs:73

I/mono    ( 8244):   at
Android.Runtime.JavaTypeConverter`1/Convert.ToJavaObject (string) [0x00000]
in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaTypeCo
nverter.cs:166

I/mono    ( 8244):   at
Android.Runtime.JavaTypeConverter`1/StringConverter.ToNative (string)
[0x00000] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaTypeCo
nverter.cs:283

I/mono    ( 8244):   at Android.Runtime.JavaList`1.Add (T) [0x00000] in
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaList.c
s:256

I/mono    ( 8244):   at Android.Runtime.JavaList`1..ctor
(System.Collections.Generic.IEnumerable`1<T>) [0x00019] in
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaList.c
s:242

I/mono    ( 8244):   at Android.Runtime.JavaList`1.ToNative
(System.Collections.Generic.IList`1<T>) [0x00017] in
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaList.c
s:325

I/mono    ( 8244):   at Android.Widget.ArrayAdapter`1..ctor
(Android.Content.Context,int,System.Collections.Generic.IList`1<T>)
[0x000aa] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Android.Widget/Arr
ayAdapter.cs:103

I/mono    ( 8244):   at
com.xxxdictionary.android.CustomisedTypefaceArrayAdapter`1..ctor
(Android.Graphics.Typeface,Android.Content.Context,int,System.Collections.Ge
neric.IList`1<T>) <IL 0x00005, 0x00067>

I/mono    ( 8244):   at
com.xxxdictionary.android.WordSearchActivity.UpdateSuggestions
(System.Collections.Generic.IList`1<string>) [0x00032] in
/Users/steven_john_pack/Dev/mono/projects/xxxDictionary/xxxDictionaryAndroid
App/WordSearchActivity.cs:130

I/mono    ( 8244):   at
xxxDictionary.Lib.WordSearchPresenter/<GenerateSuggestions>c__AnonStorey4.<>
m__A () [0x00000] in
/Users/steven_john_pack/Dev/mono/projects/xxxDictionary/xxxDictionary.Lib.Mo
no/MVP/WordSearchPresenter.cs:128

I/mono    ( 8244):   at Java.Lang.Thread/RunnableImplementor.Run ()
[0x0000b] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/src/Java.Lang/Thread.c
s:32

I/mono    ( 8244):   at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr)
[0x00008] in 
/Users/jon/Development/xamarin/monodroid/Mono.Android/platforms/android-7/sr
c/generated/Java.Lang.IRunnable.cs:69

I/mono    ( 8244):   at (wrapper dynamic-method)
object.437f0e9e-50ff-4c70-b860-4e773c3c1de8 (intptr,intptr) <IL 0x0000c,
0x0002b>

I/mono    ( 8244):   at (wrapper native-to-managed)
object.437f0e9e-50ff-4c70-b860-4e773c3c1de8 (intptr,intptr) <IL 0x0001e,
0xffffffff>



The class being instantiated is:



public class CustomisedTypefaceArrayAdapter<T> : ArrayAdapter<T>

{

Typeface _typeface;

public CustomisedTypefaceArrayAdapter (Typeface typeface, Context context,
int textViewResourceId, IList<T> objects)

: base(context, textViewResourceId, objects)

{

_typeface = typeface;

}

public override View GetView (int position, View convertView, ViewGroup
parent)

{

View v = base.GetView (position, convertView, parent);

if (v is TextView)

{

((TextView)v).SetTypeface (_typeface, 0);

}

return v;

}

} 





I thought I'd post it, since I also get the stack traceless exception on my
device and I thought it might be related.





Steve Pack

(m) 0450 164 216

(e) [email protected]


_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to