❔ Basket List<Product> issue
I got 2 different error here. One is Value cannot be null. Parameter name: source.
Another one is object reference not set to an instance of an object.
They dont happen at the same time. When I fix one, other happens. I think it s from basket.Products.Add(product); but I couldnt fix it




4 Replies
You "think" it's from there? Use the debugger and determine for sure what's null... there should be no reason why you aren't certain
if it's a valid case where that thing could sometimes be null, add a check to ensure that it's not null before you use it
if it should never be null, you'd need to figure out why it is and fix that
$debug
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.