1

We are trying to personalize a component based on a Device Detection rule where the query string matches value. This is not working properly and below error is getting logged in Sitecore logs.

Any one faced this issue earlier?

ERROR Failed to get type of condition
Exception: System.ArgumentException
Message: GenericArguments[0], 'Sitecore.Rules.ConditionalRenderings.ConditionalRenderingsRuleContext', on 'Sitecore.Rules.Devices.QueryStringCondition`1[T]' violates the constraint of type 'T'.
Source: mscorlib
  at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
  at System.RuntimeType.MakeGenericType(Type[] instantiation)
  at Sitecore.Reflection.ReflectionUtil.GetGenericType(String typeName, Type genericArgumentType)
  at Sitecore.Rules.DefaultRuleFactory.GetRuleCondition[T](Database database, XElement element)
Nested Exception:
Exception: System.TypeLoadException
Message: GenericArguments[0], 'Sitecore.Rules.ConditionalRenderings.ConditionalRenderingsRuleContext', on 'Sitecore.Rules.Devices.QueryStringCondition`1[T]' violates the constraint of type parameter 'T'.
Source: mscorlib
  at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, Int32 numGenericArgs, ObjectHandleOnStack type)
  at System.RuntimeTypeHandle.Instantiate(Type[] inst)
  at System.RuntimeType.MakeGenericType(Type[] instantiation)
7
  • Can you add code that is causing the error?
    – wiero
    Commented Mar 7, 2018 at 12:11
  • Sorry, we are using out of the box rule. There is no custom code. Commented Mar 7, 2018 at 12:39
  • Can you open /sitecore/system/Settings/Rules/Definitions/Elements/Device Detection/Query String item in master database and check that field Type has "Sitecore.Rules.Devices.QueryStringCondition,Sitecore.Kernel" value?
    – Anton
    Commented Mar 7, 2018 at 17:17
  • @Anton, yes we have the same value there. "Sitecore.Rules.Devices.QueryStringCondition,Sitecore.Kernel" Commented Mar 8, 2018 at 6:03
  • did you do a Sitecore upgrade before it appeared? maybe the one of Sitecore dll-s not correct. Commented Mar 8, 2018 at 8:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.