EF Core Beta3 : error ORA-12704: character set mismatch. Happens on a DbSet Select statement when ma — oracle-tech

    Forum Stats

  • 3,716,134 Users
  • 2,242,961 Discussions
  • 7,845,841 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

EF Core Beta3 : error ORA-12704: character set mismatch. Happens on a DbSet Select statement when ma

4000395
4000395 Member Posts: 2
edited May 2019 in ODP.NET

it looks like an auto generated query is created malformed.

Note the N'' instead of 'N' in the stack below.

Please find a working project that reproduce the bug in the link below,

https://github.com/ormarom/examples/tree/master/oracle/OracleError/OracleErrorExample

To run:

  1. Update the User Password and DataSource in the appsttings json file under connectionString:Oracle.
  2. Start debugging from the Program, the table will be created code first, so make sure the user has privileges.
  3. Then I add a few entities (works fine)
  4. Then I try to get the entities and Map them to a DTO using Select with a mapping expression.
  5. The crash is in the ToListAsync, in the system aggregate class with the error below.

Note that this works fine with MsSql provider.

Hope this helps, I would really appreciate a fix for this, thank you!

call stack:

Microsoft.EntityFrameworkCore.Query:Information: 2019-05-15 22:37:44.776788 ThreadID:1   (ENTRY)   OracleQuerySqlGenerator.ctor() :  OracleSQLCompatibility: 12

Microsoft.EntityFrameworkCore.Query:Information: 2019-05-15 22:37:44.788727 ThreadID:1   (SQL)     OracleQuerySqlGenerator.GenerateLimitOffset() : Limit:null

Exception thrown: 'OracleInternal.Network.NetworkException' in Oracle.ManagedDataAccess.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.ManagedDataAccess.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.ManagedDataAccess.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.ManagedDataAccess.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.ManagedDataAccess.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

'iisexpress.exe' (CoreCLR: clrhost): Loaded 'c:\program files\dotnet\shared\Microsoft.NETCore.App\2.2.2\System.Reflection.Metadata.dll'. Cannot find or open the PDB file.

Microsoft.EntityFrameworkCore.Database.Command:Error: 2019-05-15 22:37:45.322761 ThreadID:1   (ERROR)   OracleRelationalCommand.ExecuteAsync() :  Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12704: character set mismatch

   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)

   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

--- End of stack trace from previous location where exception was thrown ---

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

Microsoft.EntityFrameworkCore.Database.Command:Error: Failed executing DbCommand (526ms) [Parameters=[], CommandType='Text', CommandTimeout='0']

SELECT CASE

    WHEN "domain"."PRJP_AUT_HOST_POOL_ID" IS NOT NULL

    THEN CAST("domain"."PRJP_AUT_HOST_POOL_ID" AS VARCHAR2(11)) ELSE N''

END "AutPoolID", "domain"."PRJP_CONCURRENT_RUNS" "ConcurrentRuns", CASE

    WHEN "domain"."PRJP_DIAGNOSTICS_SERVER_ID" IS NOT NULL

    THEN CAST("domain"."PRJP_DIAGNOSTICS_SERVER_ID" AS VARCHAR2(11)) ELSE N''

END "DiagnosticsServerId", "domain"."PRJP_DOMAIN" "Domain", CASE

    WHEN "domain"."PRJP_HOST_POOL_ID" IS NOT NULL

    THEN CAST("domain"."PRJP_HOST_POOL_ID" AS VARCHAR2(11)) ELSE N''

END "HostPoolID", "domain"."PRJP_MACHINE_LIMIT" "HostsLimit", "domain"."PRJP_ID" "ID", "domain"."PRJP_PROJECT_NAME" "Name", CASE

    WHEN "domain"."PRJP_PROJECT_ID" IS NOT NULL

    THEN CAST("domain"."PRJP_PROJECT_ID" AS VARCHAR2(11)) ELSE N''

END "ProjectID", "domain"."PRJP_REC_RES_ENABLED" "RecurrentReservation", "domain"."PRJP_STATE" "State", "domain"."PRJP_TOOLS_OPTIONS" "ToolsOptions", "domain"."PRJP_TOTAL_VUDS_USED" "TotalConsumption", "domain"."PRJP_PROJECT_UID" "UniqueID", "domain"."PRJP_VUDS_LIMIT" "VUDSLimit", "domain"."PRJP_VUGEN_WORKING_MODE" "VugenWorkingMode", "domain"."PRJP_VUSER_LIMIT" "VusersLimit", CASE

    WHEN "domain"."PRJP_FUNC_PROLONG_DURATION" IS NOT NULL

    THEN CAST("domain"."PRJP_FUNC_PROLONG_DURATION" AS VARCHAR2(11)) ELSE N''

END "TestExtendDuration", CASE

    WHEN "domain"."PRJP_MAX_NUM_OF_PROLONGS" IS NOT NULL

    THEN CAST("domain"."PRJP_MAX_NUM_OF_PROLONGS" AS VARCHAR2(11)) ELSE N''

END "MaxNumberOfProlongs"

FROM "LAB_PROJECT_PROPERTIES" "domain"

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12704: character set mismatch

   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)

   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

--- End of stack trace from previous location where exception was thrown ---

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.EntityFrameworkCore.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Microsoft.EntityFrameworkCore.Relational.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Oracle.EntityFrameworkCore.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Query:Error: An exception occurred while iterating over the results of a query for context type 'OracleErrorExample.Infra.LabDbContext'.

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12704: character set mismatch

   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)

   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

--- End of stack trace from previous location where exception was thrown ---

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12704: character set mismatch

   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)

   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)

   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

--- End of stack trace from previous location where exception was thrown ---

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)

   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in Microsoft.EntityFrameworkCore.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Exception thrown: 'Oracle.ManagedDataAccess.Client.OracleException' in System.Private.CoreLib.dll

Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll

The thread 0x3300 has exited with code 0 (0x0).

The program '[4812] iisexpress.exe' has exited with code -1 (0xffffffff).

Answers

Sign In or Register to comment.