Hi
I have been getting random null reference exceptions in my app when running
on lower end devices (galaxy ace in this case), but not on a desire s or
emulators.  They mostly seem to be in and around my data access to sqlite
(using sqlite-net) although I haven't been able to pin point them to any one
bit of code.  Generally it will crash with the only stacktrace being that
there was a null reference exception and nothing to indicate where and so I
have been using logging to try to get an idea of the source of the issues
but it seems to shift around.  Then today the debugger actually caught one
of these occurences but when checking out the variables in scope 'this' was
null (I have a screen shot if you would like it as in theory this isn't
possible).  'this' being a singleton instance of a class which was running
some data updates on a background thread (started from my activity using
ThreadPool.QueueUserWorkItem(state => _dp.CheckCacheAge()); ).  At this
point there is not a lot going on in the current activity which is simply
waiting on the updates and has some event handlers attached to update the ui
with progress.  This particular crash happened at a point where there is not
a great deal loaded into memory.

stacktrace:

System.NullReferenceException: Object reference not set to an instance of an
object
at (wrapper stelemref) object:virt_stelemref_class (intptr,object)
  at MyDevon.DataProvider.PopulateConfiguration () [0x0001b] in
/Projects/NVG/Around Me Android/branches/My Devon/Around
Me/DataAccess/DataProvider.cs:225 

The log from another occurence (included last reference to garbage
collection):

06-25 11:22:09.119: D/Mono    ( 3076): GC_MINOR: pause 37.06ms, bridge
0.00ms promoted 912K major 5008K los 7416K
.....
06-25 11:22:09.659: D/SQLite(3076): ExecuteNonQuery
06-25 11:22:09.659: D/SQLite(3076): ExecuteNonQuery
06-25 11:22:09.659: D/SQLite(3076): ExecuteNonQuery
06-25 11:22:09.669: D/MD-DataProvider(3076): started insert
06-25 11:22:09.669: D/SQLite(3076): ExecuteNonQuery
06-25 11:22:09.669: I/mono(3076): Stacktrace:
06-25 11:22:09.679: E/mono(3076): [0x7f5420:] EXCEPTION handling:
System.NullReferenceException: Object reference not set to an instance of an
object

These crashes are intermitent as in they do not occur in the same place each
time and only occur roughly 1 in every 3 runs of the full update routine. 
There doesn't seem to be any correlation with timings of the GC either, but
it does feel like something external is killing off my static instance of
this class.

Any advice of where to look on this one would be very helpful as I'm
completely at a loss.

thanks

Keith


--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/this-is-null-null-reference-exception-tp5710505.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to