Bind variable mapping in error log is wrong
We have netcore application with NHibernate 5.3.10 version. We also tried with the latest 5.3.13, nothing changed. When we try to execute an SQL statement, if it is successfully executed the log shows correct mapping for bind variables used in SQL query and the definitions of them. However if there is any issue on execution the error log shows shifted parameter names rather than used ones in SQL query. In SQL query it uses p0 and p1 for example but in log values are represented inside p1 and p2 even SQL still has p0 and p1.
Following log for successful operation;
NHibernate: select execution0_.ID as id1_0_, execution0_.STARTDATE as startdate2_0_, execution0_.STATUS as status3_0_ from ACME_EXECUTION execution0_ where execution0_.STARTDATE>:p0 and execution0_.STATUS<>:p1;:p0 = 2022-10-18T14:45:10.6502189+03:00 [Type: DateTime (0:0:0)], :p1 = 4 [Type: Int32 (0:0:0)]
Following log is for error;
NHibernate.Exceptions.GenericADOException: could not execute query [ select execution0_.ID as id1_0_, execution0_.STARTDATE as startdate2_0_, execution0_.STATUS as status3_0_ from ACME_EXECUTION execution0_ where execution0_.STARTDATE>:p0 and execution0_.STATUS<>:p1 ] Name:p1 - Value:18.10.2022 14:45:10 Name:p2 - Value:4 [SQL: select execution0_.ID as id1_0_, execution0_.STARTDATE as startdate2_0_, execution0_.STATUS as status3_0_ from ACME_EXECUTION execution0_ where execution0_.STARTDATE>:p0 and execution0_.STATUS<>:p1]
Following attachment has a sample application that needs first argument as a connection string.