title: An exception of type 'System.NullReferenceException' occurred in EntityFramework.dll but was not handled in user code : Executing a stored procedure
body: <p>I have my code below: </p>
  
  <pre><code> User user = new User();
    WFMModel db = new WFMModel();
    SqlParameter param1 = new SqlParameter("@username", username);
    SqlParameter param2 = new SqlParameter("@password", password);
    SqlParameter param3 = new SqlParameter("@Version", Version);`
  
  
  
  var userData = db.Database.SqlQuery&lt;User&gt;("usp_Rep_App_DotNet_Validate_User_new @username,@password,@Version",
  param1, param2, param3);
  </code></pre>
  
  <p>And I have my User class as below:</p>
  
  <pre><code>public class User
      {
          public string UserID;
          public string FirstName;
          public string LastName;
          public string Message;
          public string Department;
      }
  </code></pre>
  
  <p>But when the code executes, I get the error:
  An exception of type 'System.NullReferenceException' occurred in EntityFramework.dll but was not handled in user code.</p>
  
  <p>When I run the stored procedure, I get the data without any issues (no nulls as well).</p>
  
  <p>Any idea what's going on?
  Thanks in advance.</p>