Troubleshooting — EricksonLopez.DapperExtensions
L3StableNuGet: v2.0.0Local HEAD: v3.1.0AOT: Full
Common runtime and AOT pitfalls when adopting EricksonLopez.DapperExtensions (2.0.0).
NotSupportedException from CreateSavepointAsync (BC-001)
Section titled “NotSupportedException from CreateSavepointAsync (BC-001)”- Symptom: Calling
uow.CreateSavepointAsync("sp_step1")throwsSystem.NotSupportedException. - Cause: In
v2.0.0(BC-001),NoOpSavepointwas removed. If the underlyingIDbTransactiondoes not inherit fromSystem.Data.Common.DbTransaction(for example, a rawIDbTransactionmock), savepoints are rejected. - Fix: Use a real ADO.NET
DbTransactionor inherit fromDbTransactionin test doubles.
ArgumentException on cursorColumn or Closed Connection After BulkInsertAsync
Section titled “ArgumentException on cursorColumn or Closed Connection After BulkInsertAsync”- Invalid
cursorColumn(BC-003):QueryCursorPagedAsyncvalidatescursorColumnagainst an identifier regex (SegmentRegex) to block SQL injection; pass a plain or quoted single column identifier ("id","\"id\""). - Connection state (
BC-004):BulkInsertAsyncopens and closes connections it opened itself, whereas caller-opened connections remain open. Open the connection beforeBeginUnitOfWorkAsyncorBulkInsertAsyncwhen reusing it across multiple operations.
StreamAsync<T> Native AOT Warning (ADR-019)
Section titled “StreamAsync<T> Native AOT Warning (ADR-019)”DapperStreamingExtensions.StreamAsync<T>relies on Dapper’s runtimeGetRowParser<T>reflection emit (IL2026/IL3050). For Native AOT deployments, replaceStreamAsync<T>with[SqlEntity]+EricksonLopez.DapperExtensions.SourceGeneratorsandMultiMapBuilder<T>.