1
votes

Bugsense is telling me that I am getting a lot of exceptions like with this, in my WinRT Phone application

title:

A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.

and this stackstrace:

    0 System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.NullReferenceException: Object reference not set to an instance of an object.           

 1 at ABC.Core.IncrementalLoadingCollection`1.<>c__DisplayClass20_0.<<LoadMoreItemsAsync>b__0>d.MoveNext()
    2 --- End of inner exception stack trace ---
    3---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
    4 at ABC.Core.IncrementalLoadingCollection`1.<>c__DisplayClass20_0.<<LoadMoreItemsAsync>b__0>d.MoveNext()<---
    5
    6--- Inner exception of type System.NullReferenceException start ---
    7--- Message: Object reference not set to an instance of an object. ---
    8System.NullReferenceException: Object reference not set to an instance of an object.
    9 at ABC.Core.IncrementalLoadingCollection`1.<>c__DisplayClass20_0.<<LoadMoreItemsAsync>b__0>d.MoveNext()
    10--- End of inner exception stack trace ---

Has anyone ever had this before? Should I move IncrementalLoadingCollection into the main app and not have the class in a seperate dll?

1

1 Answers

0
votes

Being in a DLL shouldn't matter; you should turn on 1st-chance exceptions in order to figure out where the exception is happening and to fix it - something is obviously null when it shouldn't be. You can turn on 1st-chance exceptions via the Debug -> Exceptions dialog and checking the Thrown column.

Also, as a general practice you shouldn't have async methods that don't protect themselves against exceptions (or that don't explicitly rely on their caller to do so).