Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Jan 10, 2018 @ 14:46
    Nik
    0

    Object of type 'System.String' cannot be converted to type 'System.Boolean'

    Hi all,

    Hoping someone can point me in the right direction with a bit of an odd issue.

    I've got the latest version of Umbraco Forms installed onto Umbraco 7.7.7. In addition I've got the Preplex package - Umbraco Forms on Perplex steroids installed.

    I've created a simple form with the following fields:

    Name, Email, Phone (all perplex text strings), Summary ( perplex text area), Attachments (perplex file upload).

    When I first call a page with the form on, on the front end I get an odd error:

    Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'
    

    It happens when this line of code executes:

     Html.RenderAction("RenderForm", "UmbracoForms", new {formId = form, recordId = recordGuid, theme = theme, includeScripts = includeScripts });
    

    If I continue the execution I get a YSOD which gives a bit more information:

    Object of type 'System.String' cannot be converted to type 'System.Boolean'.

    The Stack Trace for the error is as follows:

    [ArgumentException: Object of type 'System.String' cannot be converted to type 'System.Boolean'.] System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) +6131358 System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) +197 System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +229 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +96 System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) +35 Umbraco.Forms.Core.Field.get_FieldType() +445 Umbraco.Forms.Mvc.Models.FormViewModel.Build(Form form) +3146 Umbraco.Forms.Web.Controllers.UmbracoFormsController.GetFormModel(Guid formId, Nullable`1 recordId) +462

    The bit that's really odd is that if I refresh the page after the YSOD, it works. No problems. But the first time the page loads after a website restart the YSOD is back. This appears to be happening in the back office as well when trying to edit the form.

    I can't seem to find out what parameters it's complaining about so I'm looking for some guidance on how to identify and solve this issue? Any ideas would be great.

    Thanks,

    Nik

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Jan 22, 2018 @ 07:48
    Daniël Knippers
    0

    Hi Nik,

    I work at Perplex and helped create our forms package. Does the issue only occur if your use the Perplex FieldTypes in your form? If so, can you make sure you have the latest version (1.8) of our package installed, as it should work fine with Umbraco 7.7. If that still does not work, try to create a new form to see if that makes a difference.

    It seems to crash at some point after Umbraco.Core.Field.get_FieldType, which all our field types also provide (see here for PerplexTextField for example]) as we inherit from Umbraco.Core.Field. I am not sure how that leads to a String to Boolean conversion error though.

    Regards, Daniël

  • Matt Barlow | jacker.io 164 posts 740 karma points c-trib
    Feb 04, 2018 @ 10:37
    Matt Barlow | jacker.io
    0

    We're on umbraco 7.7.4 and having the same issue, but it only occurs with #the forms that have the perplex file upload on them. Did you manage to resolve this?

  • Matt Barlow | jacker.io 164 posts 740 karma points c-trib
    Feb 04, 2018 @ 11:55
    Matt Barlow | jacker.io
    0

    More information

    I was concerned it was something custom I had done, so instead I made a fresh install:

    Umbraco 7.7.9 Umbraco Forms 6.0.6 Perplex Forms 1.8

    I included the Perplex File upload only on the form, and I get the error: enter image description here

    Also, to replicate, you need to recycle the app pool.

    Any help with this would be great.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Feb 04, 2018 @ 12:42
    Nik
    1

    That's good to know someone else is getting the same issue. I hadn't had a chance to revisit it so still have the issue at the minute which is frustrating. At least now there are steps to reproduce :-)

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Feb 05, 2018 @ 10:59
    Daniël Knippers
    1

    Hi guys,

    It seems to be caused by the Multi upload setting that is specified on our File Upload field type (see here). I wonder if something perhaps changed in Forms.Core in the way settings are read. The value of this checkbox is saved as a String ("True" or "False"), so that would likely cause this error.

    I have changed the code slightly in the way the Multi Upload setting is declared, and it seems to work on my end now. It now longer uses the [Setting] attribute but rather overrides the virtual Settings() method of Umbraco.Forms.Core.FieldType. Not sure why it would make a difference, but I do not get the crash anymore.

    Could you try the hotfix I posted on our package page (Perplex.Umbraco.Forms.dll, uploaded just now)? If it works I can update our package soon, although you do not have to update the package as the DLL will be the only thing that will be changed.

    -- Daniël

  • Umbrakko 9 posts 104 karma points
    Feb 05, 2018 @ 16:07
    Umbrakko
    1

    Just registered here to reply to your post, that's working now. I had the same issue, it was indeed caused by the multiple files bool.

    That said, I now cannot select file types anymore (and a file size).

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Feb 06, 2018 @ 09:50
    Nik
    0

    Hi Daniël

    From my initial tests I can confirm that this hotfix does indeed seem to resolve the issue. I've not yet tested doing uploads with the form, but it is now rendering without the issue. I'll let you know if there are any issues using it.

    Thanks,

    Nik

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Feb 08, 2018 @ 08:58
    Daniël Knippers
    100

    I have updated our package to 1.8.1 which includes this new DLL, as it seems to fix the exception. Those of you who already downloaded the DLL separately do not necessarily need to update the package as nothing else was changed.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Feb 08, 2018 @ 09:03
    Nik
    0

    Daniël, is there any chance of you guys releasing the package as a nuget package? It would be wonderful to have it available that way :-) (I know the question is slightly off topic now)

  • Umbrakko 9 posts 104 karma points
    Feb 08, 2018 @ 09:44
    Umbrakko
    0

    Thanks Daniël, but it's no longer possible to change the settings of the file types and file sizes. And could you also commit the changes to GitHub?

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Feb 08, 2018 @ 10:02
    Daniël Knippers
    1

    Hi Umbrakko,

    Ah, apparently we cannot mix the [Setting] attribute with the Settings() dictionary... Should be fixed now in 1.8.2. Also updated the hotfix DLL. GitHub will follow later soon, this is just a side-project for us so I do not actually have too much time for it unfortunately :)

  • Umbrakko 9 posts 104 karma points
    Feb 08, 2018 @ 10:04
    Umbrakko
    0

    Awesome, thank you, now it's working fine.

Please Sign in or register to post replies

Write your reply to:

Draft