Details about the error you see:
NullReferenceException Class (System) | Microsoft Docs[
^]
Quote:
A NullReferenceException exception is thrown when you try to access a member on a type whose value is null
Possibly because:
1. You've forgotten to instantiate a reference type
2. You've forgotten to dimension an array before initializing it.
3. You get a null return value from a method, and then call a method on the returned type.
4. You're using an expression (for example, you're chaining a list of methods or properties together) to retrieve a value
5. You're enumerating the elements of an array that contains reference types, and your attempt to process one of the elements throws
6. Exception is thrown by a method that is passed null
Following will help you learn about debugging:
Tutorial: Debug Visual Basic code - Visual Studio | Microsoft Docs[
^]
First look at the debugger - Visual Studio | Microsoft Docs[
^]
When you debug, you will be able to get the exact line where the variable is NULL and error is being raised.
For now, in your case, following has high potential:
return await _db.ShopCategoties.ToListAsync();
Either
_db
is null or
_db.ShopCategories
is
null
and thus conversion to list fails. Handle/Resolve on why so.
Try out.