DBContext - ArgumentNullException

ravikrishnaravikrishna Posts: 7 New member
edited August 29, 2018 5:12AM in SmartAssembly
Hi,

A very simple basic code is throwing the exception. 

var dbContext = new CustomDBContext();<br><b>var result = dbContext.tblXXX;</b>
The above line is throwing the "System.ArgumentNullException"

System.ArgumentNullException: Value cannot be null.
Parameter name: source
--at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source): 

This is strange because, when we run the application directly, the value is NEVER Null. Only through the Smart Assembly when we build and run, I'm encountering this issue. Any help would be appreciated.

Thanks,
Ravi
Tagged:

Answers

  • Can you share a reproduction of this in your wider code? We weren't able to reproduce this using your example.
    Have you visited our Help Centre?
  • malcomjarrmalcomjarr Posts: 1 New member
    System.ArgumentNullException: Value cannot be null.

    The  exception that is thrown when a C# null reference is passed to a method that does not accept it as a valid argument. An ArgumentNullException exception is thrown at run time in the following two major circumstances:
    • An uninstantiated object is passed to a method. To prevent the error, instantiate the object.
    • An object returned from a method call is then passed as an argument to a second method, but the value of the original returned object is null. To prevent the error, check for a return value that is null and call the second method only if the return value is not null.


Sign In or Register to comment.