Custom boolean field 'Cannot convert attribute "val

Posted by Community Admin on 05-Aug-2018 16:50

Custom boolean field 'Cannot convert attribute "value" to type "System.Boolean"'

All Replies

Posted by Community Admin on 23-Mar-2011 00:00


hey folks, I just tried to add a custom YesNo field to the products module through the interface and although the process seemed to complete without error, but now I receive the message below when trying to view the Products module. is there a bug in the way these values are parsed?

i looked at the xml config for the module and the value field seems pretty straightforward

<field mutuallyExclusive="True" renderChoiceAs="SingleCheckBox" hideTitle="True" dataFieldName="Taxable" value="False" type:value="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" wrapperTag="Li" title="Taxable" example="Should taxes be applied to this product" fieldType="Telerik.Sitefinity.Web.UI.Fields.ChoiceField" type:fieldType="System.RuntimeType, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" cssClass="" hidden="False" fieldName="Taxable" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.ChoiceFieldElement, Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563">
<choicesConfig>
<clear />
<element text="Taxable" value="True" enabled="False" selected="False" />
</choicesConfig>
<validator expectedFormat="None" maxLength="0" minLength="0" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Ivalid format." requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
<expandableDefinition expandText="" expanded="True" />
                                </field>
                            </fields>


Cannot convert attribute "value" to type "System.Boolean". Line number 22.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.ConfigurationErrorsException: Cannot convert attribute "value" to type "System.Boolean". Line number 22.

Source Error:

[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\0360db66\2be72016\App_Web_telerik.sitefinity.resources.sitefinitydefault.aspx.f785aa1a.rr2us6pr.0.cs    Line: 0

Stack Trace:

[ConfigurationErrorsException: Cannot convert attribute "value" to type "System.Boolean". Line number 22.]
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadValue(XmlReader reader, String propertyName, Type definedType, ConfigProperty property) +422
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadAttributes(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +196
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +56
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +381
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +297
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +324
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +427
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +381
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +297
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +324
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +427
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +381
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +297
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +324
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +427
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +381
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +297
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +324
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean isUpgrading) +427
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +260
   Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +149
   Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +16
   Telerik.Sitefinity.Configuration.Config.GetConfigSection(String name) +233
   Telerik.Sitefinity.Configuration.Config.GetByPath(String path) +61
   Telerik.Sitefinity.Configuration.ConfigElementLink.GetLinkedElement() +47
   Telerik.Sitefinity.Configuration.ConfigElementDictionary`2.TryGetValueInternal(TKey key, TElement& element) +107
   Telerik.Sitefinity.Configuration.ConfigElementDictionary`2.get_Item(TKey key) +19
   Telerik.Sitefinity.Web.UI.ContentUI.ContentViewControlDefinition.GetConfigurationDefinition() +64
   Telerik.Sitefinity.Web.UI.DefinitionBase.get_ConfigDefinition() +21
   Telerik.Sitefinity.Web.UI.DefinitionBase.ResolveProperty(String propertyName, T instanceValue, T defaultValue) +226
   Telerik.Sitefinity.Web.UI.DefinitionBase.ResolveProperty(String propertyName, T instanceValue) +62
   Telerik.Sitefinity.Web.UI.ContentUI.ContentViewControlDefinition.get_ManagerType() +35
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.ResolveContentManager() +28
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.ResolveDetailItem() +76
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.CreateChildControls() +35
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8387
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
   System.Web.UI.Page.ProcessRequest() +78
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.sfres_telerik_sitefinity_resources_sitefinitydefault_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\0360db66\2be72016\App_Web_telerik.sitefinity.resources.sitefinitydefault.aspx.f785aa1a.rr2us6pr.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Posted by Community Admin on 23-Mar-2011 00:00

I commented out the field definitions in the .config file and then I could load the manager, view products, and edit custom fields. Setting it's predefined value to "" caused the same issue.

I repeated the process and then put "Yes" as the default value. This time I received Cannot access a disposed object. Object name: 'Database has been disposed.'.  A restart of the app solved that and appears to allow the fields to work as expected.

I do want to note that the Products module is still exhibiting the behavior I described in the post linked below. (i.e when I add a Custom field I will get itemContext.item is null or undefined, and return code 0 when trying to Edit/Insert. Turning off the app, Clearing cache and walking away for a while seems to fix this, but it's frustrating as heck for an end user, and unacceptable for a production site.
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/sdk/custom-field-in-products-causes-return-code-0-or-itemcontext-is-undefined.aspx

Posted by Community Admin on 29-Mar-2011 00:00

Hi Drew,

Thank you for the feedback. 
We agree that there is a lot to polish in this area. Fortunately with the Q1 release, we will bring a lot of improvements all over the place. 

All the best,
Georgi
the Telerik team

This thread is closed