Open El-Gor-do opened 7 months ago
On further investigation, the code runs successfully with AOT if I replace ExecuteScalarAsync<int>
with ExecuteAsync
. It may be that my usage has been wrong all along. Even so, without AOT, ExecuteScalarAsync<int>
doesn't throw in this example.
Describe the bug
I am using .Net 8, Dapper 2.1.24 and Dapper.AOT 1.0.31 with SQL Server 2019 LocalDb.
I am trying to set session context variables by calling the system stored procedure
sp_set_session_context
- https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-set-session-context-transact-sql?view=sql-server-ver16When calling
ExecuteScalarAsync
, anArgumentNullException
is thrown when using AOT but does not throw when not using AOT. The method below reproduces the bug.Without
[DapperAot]
attribute or if the attribute is set to[DapperAot(false)]
thenExecuteScalarAsync
does not throw.Here is the top of the stack trace excluding the calls from my test app.
Expected behavior
ExecuteScalarAsync
should not throw.