Copied to clipboard

Flag this post as spam?

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


  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    Aug 30, 2017 @ 16:03
    Marc Love (uSkinned.net)
    0

    Strange Issue with Models Builder

    Hi Folks,

    I am getting a really strange issue with Models builder on a customers live environment.

    Say I have a Textstring property on a Document Type called testProperty.

    I am then using this property on a view where I pass it into a helper function.

    the helper function expects a string e.g

    MyHelper.DoSomething(Model.TestProperty)
    

    The type of the testProperty should be automatically recognised as a string and this is the case on my local environment however on the live environment I get an error:

    The best overloaded method match for 'MyHelper.DoSomething(string)' has some invalid arguments

    Changing the call to the helper to the following works:

    MyHelper.DoSomething(Model.TestProperty.ToString())
    

    Anyone have any ideas why this is happening on the live environment?

    Cheers,

    Marc

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    Aug 31, 2017 @ 09:39
    Marc Love (uSkinned.net)
    0

    Just to add to this, carried out some testing which is making this issue even more confusing.

    Model.TestProperty.GetType()
    

    Running this line of code gives me: System.String

    So the type of the variable is recognised however when I pass the variable into the function it is no longer recognised as a string.

    Heeeeeelllppppppp!!!

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Oct 03, 2017 @ 09:25
    Chriztian Steinmeier
    0

    Hi Marc,

    Did you figure out why this happens?

    I'm seeing the same problem and it bugs me to no end having to do Alias.ToString() everything or GetPropertyValue<string>("alias") ...

    /Chriztian

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    Oct 03, 2017 @ 12:38
    Marc Love (uSkinned.net)
    0

    Hi Christian,

    My client had changed settings in ~/config/umbracoSettings.config. Not entirely sure what setting was causing the issue though. The settings we changed were:

    1.

    <MacroErrors>inline</MacroErrors>
    

    changed to

    <MacroErrors>throw</MacroErrors>
    

    2.

    <web.routing trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false" umbracoApplicationUrl="">
    

    changed to

    <web.routing trySkipIisCustomErrors="false" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false" umbracoApplicationUrl="">
    
Please Sign in or register to post replies

Write your reply to:

Draft