Skip to content

Null Reference Exception in ODP.Net when using Dapper #449

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
marcwittke opened this issue Apr 24, 2025 · 1 comment
Open

Null Reference Exception in ODP.Net when using Dapper #449

marcwittke opened this issue Apr 24, 2025 · 1 comment

Comments

@marcwittke
Copy link

reopening #426 now with full trace

This is the exception I seein tests after bumping the ODP.Net managed library to versions above 23.5.1, here for example with 23.8.0

The error happens intermittently on different tests with different columns, sometimes it hits a column of a view, a table or a materialized view, but the error is always related to parsing Int64

System.Data.DataException: Error parsing column 3 (TRANSPORT_BOX_TYPE=0 - Int64)

System.Data.DataException
Error parsing column 3 (TRANSPORT_BOX_TYPE=0 - Int64)
   at Dapper.SqlMapper.ThrowDataException(Exception ex, Int32 index, IDataReader reader, Object value) in /_/Dapper/SqlMapper.cs:line 3966
   at Deserialize146af5cd-22c1-4930-9f42-b974b8529d1b(DbDataReader)
   at Dapper.SqlMapper.QueryRowAsync[T](IDbConnection cnn, Row row, Type effectiveType, CommandDefinition command)
   at Wombat.Adapters.Oracle.Dapper.SqlMapperExtensions.SingleOrDefaultAsync[T](IDbConnection connection, Int64 id, CancellationToken cancellationToken)
   at Wombat.Adapters.Oracle.Tsc.TransportBoxes.TransportBoxRepository.GetByIdAsync(TransportBoxId id, CancellationToken cancellationToken)
   at Wombat.Adapters.Oracle.Tsc.TransportBoxes.TransportBoxRepository.InsertAsync(TransportBox transportBox, CancellationToken cancellationToken)
   at Wombat.Domain.Tsc.TscTestDataProvider.InsertTransportBoxesAsync(Int32 count, ITransportBoxRepository transportBoxRepository, IIdGenerator`1 idGenerator, TransportBoxType transportBoxType)
   at Wombat.Adapters.Oracle.Tests.Tsc.TheTransportBoxRepository.<>c__DisplayClass24_0.<<CanQueryAvailableTransportBoxesByTransportBoxTypes>g__InsertTransportBoxesAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Wombat.Adapters.Oracle.Tests.Tsc.TheTransportBoxRepository.CanQueryAvailableTransportBoxesByTransportBoxTypes(TransportBoxType[] transportBoxTypes)
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass47_0.<<InvokeTestMethodAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction)
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code)

System.NullReferenceException
Object reference not set to an instance of an object.
   at OracleInternal.ServiceObjects.OracleFailoverMgrImpl.OnError(OracleConnection connection, CallHistoryRecord chr, Object mi, Exception ex, Boolean bTopLevelCall, Boolean& bCanRecordNewCall)
   at Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)
   at Oracle.ManagedDataAccess.Client.OracleDataReader.get_Item(Int32 i)
   at Deserialize146af5cd-22c1-4930-9f42-b974b8529d1b(DbDataReader)

Full trace attached

RESHARPERTESTRUNNER.DLL_PID_596773_DATE_2025_04_24_TIME_10_31_26_024613.txt

@alexkeh
Copy link
Member

alexkeh commented May 2, 2025

We reviewed the trace, but couldn't conclude what the problem is. What Oracle DB data type is column 3 that becomes an Int64? Since the error occurs intermittently, is there a pattern to the values that trigger this error?

Do you have a test case that can consistently (be it intermittently) reproduce the problem?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants