- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.7k
Closed
Description
I have a SQL statement that runs fine with ngpsql v2.2.0 and dapper 1.36 which looks like so
INSERT INTO MyTable (Name,Msg) Values(@Name, @Msg); 
SELECT MAX(Id) FROM MyTable
I am using it like so:
connection.Query<int>(sql,
                     new {
                       item.Name,
                       item.Msg
                     }).First();
However when it runs with ngpsql v3.0.3 or ngpsql v3.1.0-alpha3 I get a NullReferenceException
Exception(Type:NullReferenceException):Object reference not set to an instance of an object
  at Dapper.SqlMapper+<QueryImpl>d__11`1[System.Int32].MoveNext () [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.Int32].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.Int32]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.ToList[Int32] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Dapper.SqlMapper.Query[Int32] (IDbConnection cnn, System.String sql, System.Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) [0x00000] in <filename unknown>:0
Any ideas?
I've also logged it with ngpsql as I'm unsure where the issue is: npgsql/npgsql#857
Metadata
Metadata
Assignees
Labels
No labels