Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

Open
marcwittke opened this issue Apr 24, 2025 · 2 comments
Open

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

marcwittke opened this issue Apr 24, 2025 · 2 comments

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?

@marcwittke
Copy link
Author

marcwittke commented May 6, 2025

update: it's not related to int64 only

Error parsing column 23 (=WbsElement - String)
Error parsing column 22 (COST_ASSIGNMENT_WBS_ELEMENT=CostCenter - String)
Error parsing column 2 (OPEN_REQUESTED_BY_USER_ID=5/6/2025 11:53:41 AM - DateTime)
Error parsing column 3 (OPEN_REQUESTED_BY_USER_NAME=200090 - Decimal)
Error parsing column 17 (PRODUCT_EXTERNAL_PRODUCT_PAGE_URL=<null>)

As you see there is something weird going on, _USER_ID is definitly no DateTime, but a number. And _USER_NAME is a string and no decimal.

On every test run it hits different tests with different columns. I am evaluating options to provide a reproduction right now, since this will either take some time I need to have approved or share the original code that needs to be approved also.

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

No branches or pull requests

2 participants