I am using Entity Framework and trying to call a stored procedure, but ExecuteSqlCommandAsync is is throwing an unhandled exception. I have put try/catch but code is not going into the catch block. ExecuteSqlCommand method works fine.
The exception I am getting is
System.NullReferenceException' occurred in mscorlib.dll
My code:
try
{
    var inboundsParam = new SqlParameter();
    inboundsParam.ParameterName = "@Inbounds";
    inboundsParam.SqlDbType = SqlDbType.Xml;
    inboundsParam.Direction = ParameterDirection.Input;
    inboundsParam.Value = inboundsXml;
    var incomeFoundOutParam = new SqlParameter();
    incomeFoundOutParam.ParameterName = "@IncomeFound";
    incomeFoundOutParam.SqlDbType = SqlDbType.Bit;
    incomeFoundOutParam.Direction = ParameterDirection.Output;
    var output = await dbContext.Database.ExecuteSqlCommandAsync("EXEC dbo.CalculateIncome @Inbounds, @IncomeFound OUTPUT", inboundsParam, incomeFoundOutParam);
    var incomeFound = (bool)incomeFoundOutParam.Value;
}
catch(System.Exception ex)
{
} 
Does anyone know what could be wrong with the code?
 
     
    