No coercion operator is defined between types 'System.Enum' and 'System.Boolean'.

Posts   
 
    
ErinaG
User
Posts: 22
Joined: 31-Dec-2014
# Posted on: 17-Jul-2018 16:42:52   

We just upgraded to LLBLGen Pro v5.4.2 (Build 20180710) and are getting this error at runtime. Any advice?

ErrorDescription: The following exception occurred at System.Linq.Expressions.UnaryExpression GetUserDefinedCoercionOrThrow(System.Linq.Expressions.ExpressionType, System.Linq.Expressions.Expression, System.Type): No coercion operator is defined between types 'System.Enum' and 'System.Boolean'.

The following exception occurred at Void .ctor(): The type initializer for 'SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine' threw an exception.

[...]

Stack Trace: at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType) at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method) at System.Linq.Expressions.Expression.Convert(Expression expression, Type type) at SD.LLBLGen.Pro.ORMSupportClasses.Miscellaneous.DynamicMethodCompiler.CreateSetHandler[TRootTarget,TRootValue](Type targetType, PropertyInfo propertyInfo) at SD.LLBLGen.Pro.DQE.Oracle.OracleSpecificCreator.SetDbProviderFactoryParameterData(List`1 dbProviderFactoryInvariantNamesWithEnumTypeNames, String dbProviderSpecificEnumTypePropertyName) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.4\Frameworks\LLBLGen Pro\RuntimeLibraries\OracleDQE\OracleSpecificCreator.cs:line 122 at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..cctor() in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.4\Frameworks\LLBLGen Pro\RuntimeLibraries\OracleDQE\DynamicQueryEngine.cs:line 123 at SD.LLBLGen.Pro.DQE.Oracle.DynamicQueryEngine..ctor() at Grb.Platform.Utility.License.Business.Lower.Oracle.DatabaseSpecific.DataAccessAdapter.CreateDynamicQueryEngine() in c:\Source\Production\Platform\Utilities\License\Business.Lower\Oracle (ODP.NET)\DatabaseSpecific\DataAccessAdapter.cs:line 88 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateSelectDQ(QueryParameters parameters) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateQueryFromElements(QueryParameters parameters) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedList(DataTable dataTableToFill, QueryParameters parameters) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>n__13(DataTable dataTableToFill, QueryParameters parameters) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass14_0.<FetchTypedList>b__0() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteWithActiveRecoveryStrategy(Action toExecute) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(DataTable dataTableToFill, QueryParameters parameters) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates) [...]

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 17-Jul-2018 18:23:33   

Could you please post a code snippet?

ErinaG
User
Posts: 22
Joined: 31-Dec-2014
# Posted on: 17-Jul-2018 19:41:39   
Grb.Platform.Utility.License.Business.Lower.TypedListClasses.LicenseContractTypedListTypedList resultLicenseSet = 
  new Grb.Platform.Utility.License.Business.Lower.TypedListClasses.LicenseContractTypedListTypedList();
SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket filter = resultLicenseSet.GetRelationInfo();
SD.LLBLGen.Pro.ORMSupportClasses.SortExpression sorter = new SD.LLBLGen.Pro.ORMSupportClasses.SortExpression();

using(SD.LLBLGen.Pro.ORMSupportClasses.IDataAccessAdapter adapter = Grb.Platform.Utility.License.Common.Configuration.ConfigurationManager.GetLicenseDataAccessAdapter(m_ConfigurationManagerSettings))
{
  adapter.FetchTypedList(resultLicenseSet.GetFieldsInfo(), resultLicenseSet, filter, 0, sorter, false);
}

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 17-Jul-2018 20:47:49   

For the sake of testing, could you please try using the adapter,FetchTypedList() overload that only accepts a TypedLit parameter?

ErinaG
User
Posts: 22
Joined: 31-Dec-2014
# Posted on: 17-Jul-2018 21:07:50   
Grb.Platform.Utility.License.Business.Lower.TypedListClasses.LicenseContractTypedListTypedList resultLicenseSet = 
  new Grb.Platform.Utility.License.Business.Lower.TypedListClasses.LicenseContractTypedListTypedList();

using(SD.LLBLGen.Pro.ORMSupportClasses.IDataAccessAdapter adapter = Grb.Platform.Utility.License.Common.Configuration.ConfigurationManager.GetLicenseDataAccessAdapter(m_ConfigurationManagerSettings))
{
  adapter.FetchTypedList(resultLicenseSet);
}

Running the FetchTypedList() overload that just takes the TypedList gives the same error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 09:14:35   

The type initializer exception occurs in the static construtor of the DQE, which builds an enum cache at runtime as we don't have a direct reference with the ado.net provider.

As you're using Oracle, I assume you're using .NET full ? What ODP.NET version are you using?

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 10:20:31   

The exception occurs here:


DbCommand command = _dbProviderFactoryInfo.FactoryToUse.CreateCommand();
// create a setter func which sets the BindByName property on a command object.
PropertyInfo property = command.GetType().GetProperty("BindByName");
if(property != null)
{
    _bindByNameSetterFunc = DynamicMethodCompiler.CreateSetHandler<DbCommand, object>(command.GetType(), property);     // <<<<<<<<<<<<<<
}

it looks like the property is no longer a boolean but an enum in a newer ODP.NET, but that's guesswork on my part. Could you give me the ODP.NET version number you're using? Also do you use the managed provider or the unmanaged provider? (as they use different factories and thus types)

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 10:30:55   

We can reproduce the behavior. Looking into it now. Related to a recent change in the dependency removal of DynamicMethod as it was a delisted/discontinued package so we moved to a different approach for .NETstandard. This breaks in some cases...

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 11:19:35   

As this breaks all ODP.NET usage, we're going to publish the 5.4.2 hotfix build as full build, this should fix your issue.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 11:29:11   

Please download v5.4.2 full from the website to fix this issue. We bumped the hotfix to a full release due to the severity of this issue. (as it breaks all odp.net usage, due to a change we made recently to remove Emit.Lightweight / DynamicMethod... flushed )

Frans Bouma | Lead developer LLBLGen Pro
ErinaG
User
Posts: 22
Joined: 31-Dec-2014
# Posted on: 18-Jul-2018 15:00:03   

The latest version works! Thanks for such a quick response - you guys are great smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Jul-2018 15:15:35   

ErinaG wrote:

The latest version works! Thanks for such a quick response - you guys are great smile

Thanks simple_smile Glad it's sorted! smile

Frans Bouma | Lead developer LLBLGen Pro