1

I have a Windows Phone 8.1 Application.

I have an intermittent crash in my application due to an exception with the following stack trace

Object reference not set to an instance of an object.
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at Intuit.Mint.Behaviors.BindableBase.NotifyPropertyChanged(String propertyName)
   at Intuit.Mint.ViewModels.MyViewModel.set_MyResultsCollection(CollectionViewSource value)
   at Intuit.Mint.ViewModels.MyViewModel.<GetMyDataOnQuery>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Intuit.Mint.ViewModels.MyViewModel.<<set_QueryString>b__8_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()

I have the following code.

MyResultsCollection = new CollectionViewSource();
MyResultsCollection.Source = response.ToGroups(x => x, x => x.MyProperty);
MyResultsCollection.IsSourceGrouped = true;

I verified the exception is not due to response being null. I'm unable to understand why the exception is being thrown in PropertyChangedEvenHandler of the setter of my property.

I would be very glad if someone can point me in the right direction. Thanks in advance.

HelpMatters
  • 1,299
  • 1
  • 13
  • 32
  • Is the code in Intuit.Mint.Behaviors.BindableBase.NotifyPropertyChanged yours? My random guess would be that an event is invoked there even though it has no handlers attached to it which makes it null. Either that or one of the handlers throws the exception. – yasen Jul 07 '15 at 08:11
  • _"I verified the exception is not due to response being null"_ -- well, _something_ is `null`. You need to debug the problem yourself, so that you can post a question more specific than just "the `NullReferenceException` is being thrown". Once you have, edit this question or post a new one, in which you provide [a good, _minimal_, _complete_ code example](https://stackoverflow.com/help/mcve) that reliably reproduces the problem, along with a detailed explanation of what debugging you've done, and what _specifically_ you still don't understand. – Peter Duniho Jul 08 '15 at 02:17

0 Answers0