我们的项目最近更新到较新的Oracle.ManagedDataAccess DLL(v 4.121.2.0),并且此错误已间歇性地出现.我们已经修复了几次而没有真正知道我们做了什么来修复它.
我很确定它是由CLOB字段映射到Entity Framework中的字符串引起的,然后在LINQ语句中被选中,这些语句拉动整个实体而不仅仅是一组有限的属性.
错误:
- Value cannot be null.
- Parameter name: byteArray
堆栈跟踪:
- at System.BitConverter.ToString(Byte[] value,Int32 startIndex,Int32 length)
- at OracleInternal.TTC.TTCLob.GetLobIdString(Byte[] lobLocator)
- at OracleInternal.ServiceObjects.OracleDataReaderImpl.CollectTempLOBsToBeFreed(Int32 rowNumber)
- at Oracle.ManagedDataAccess.Client.OracleDataReader.ProcessAnyTempLOBs(Int32 rowNumber)
- at Oracle.ManagedDataAccess.Client.OracleDataReader.Read()
- at System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead()
可疑实体属性:
- 'Mapped to Oracle CLOB Column'
- <Column("LARGEFIELD")>
- Public Property LargeField As String
但我相信这是映射每个Oracle矩阵的字段的正确方法:
- SELECT
- ...
- "Extent1"."LARGEFIELD" AS "LARGEFIELD",...
- FROM ... "Extent1"
- WHERE ...
我也根据Ozkan的建议尝试了这个Fluent代码,但它似乎并没有影响我的情况.
- modelBuilder.Entity(Of [CLASS])().Property(
- Function(x) x.LargeField
- ).IsOptional()
故障排除更新
经过广泛的测试,我们非常肯定这实际上是一个错误,而不是配置问题.它似乎是CLOB的内容在一组非常具体的情况下导致问题.我在Oracle Forums上交叉发布了这个,希望了解更多信息.