at IBM.Data.DB2.Core.TypeMap.FromValue(Object oValue, Int32& iByteLength, DB2Connection connection, Int32 iArrayLength, String parameterName, Boolean bMultiRowCmd)
at IBM.Data.DB2.Core.DB2Parameter.GetParamInfo(Int32 paramPos, DB2ParamInfo& paramInfo, Boolean chainBegin)
at IBM.Data.DB2.Core.DB2ParameterCollection.GetParamInfoList(Boolean chainBegin)
at IBM.Data.DB2.Core.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method, DB2CursorType reqCursorType, Boolean abortOnOptValueChg, Boolean skipDeleted, Boolean isResultSet, Int32 maxRows, Boolean skipInitialValidation)
at IBM.Data.DB2.Core.DB2Command.ExecuteReaderObject(CommandBehavior behavior, String method)
at IBM.Data.DB2.Core.DB2Command.ExecuteReader(CommandBehavior behavior)
at IBM.Data.DB2.Core.DB2Command.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
Exception was thrown at location where it has below lines of code. var dr = await cmd.ExecuteReaderAsync()
we have no issue with dotnet core 2.1 but when we updated to dotnet core 3.1 we are running into this issue.
update dotnetcore 2.1 project used ibm.data.db2.core 1.3 dotnetcore 3.1 project using ibm.data.db2.core 3.1(Unit test is passing though)
I got it working now. In dotnet core 2.1 the object value deserializes properly. In my case it is string where as in dotnet core 3.1 it is deserializes as JsonElement which was causing the issue and db2 was not recognizing the jsonelement as any type.
I switched my service to use Newtonsoftjson by adding
services.AddControllers().AddNewtonsoftJson();
and now it is properly desearilizing it.
There is an open issue here for bool which is pretty much the same as my case but my object is of type string. They also suggest there to write a custom converter for Object.