I have some code that is returning the following exception ...
Object reference not set to an instance of an object
I am trying to delve in further to get to the cause, but when I set a break-point after the calling code the break-point seems to get passed by ..
PaymentProcessor pp = new PaymentProcessor();
List<string> results = await pp.ProcessPayment();
foreach (string result in results) // Break-point set here
{
...
}
I wanted to see if the result of the method call returned any results
. I think it has to do with the method making use of async
await
. If the break-point is being skipped because of the async method how do I stop it? I use the async
code to free up the UI thread.
More details ....
The code where the exception bubbles up is ..
var paymentTask = GetPaymentUpdates();
paymentTask.Wait(); // Object not set exception occurs here.
That code would be skipped is if the exception was being thrown in the ProcessPayment
method and thus it never reaches that code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With