Copied to clipboard

Flag this post as spam?

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


  • Paul Kaplan 86 posts 139 karma points
    Jan 18, 2012 @ 02:06
    Paul Kaplan
    1

    Fixed umbraco.library.StripHtml - invalid argument

    This is not a question, rather, an answer that I will share.  I saw an older post (sorry, lost the link) where the solution was to write a method that in turn uses HtmlAgilityPack, but this seems much simpler.

    I originally had this, which produced the invalid argument error:

    @umbraco.library.StripHtml(@item.rentalCarPhone)

    I assume it's expecting some sort of Html data type rather than a string.

    So this fixes it:

    @umbraco.library.StripHtml(@item.rentalCarPhone.ToString())

    -- Paul

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 18, 2012 @ 20:43
    Gareth Evans
    0

    There are overloads for IHtmlString, string and DynamicNull.
    It would be really good if we could find out what type rentalCarPhone was returning as.

  • Paul Kaplan 86 posts 139 karma points
    Jan 19, 2012 @ 03:12
    Paul Kaplan
    0

    OK Gareth, you piqued my curiosity!

    @item.rentalCarPhone.GetType()

    yields:

    System.Web.HtmlString

    Regards -- Paul

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 19, 2012 @ 03:23
    Gareth Evans
    0

    Odd, and you're getting invalid argument when you pass that to Library.StripHtml?
    I'm a little confused by that.

    Can you try it again and umbDebugShowTrace, then copy out the error bit from the macro engine so I can see the minitrace?

  • Paul Kaplan 86 posts 139 karma points
    Jan 19, 2012 @ 13:35
    Paul Kaplan
    0

    Not sure if I'm doing this right, I appended ?umbdebugshowtrace=true to the url, but do not see a stack trace.  I do see this on the page though: Error loading Razor Script
    The best overloaded method match for 'umbraco.library.StripHtml(string)' has some invalid arguments

    Serving jury duty today, so will not be able to respond until tonight east coast US time.

    -- Paul

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 19, 2012 @ 20:47
    Gareth Evans
    0

    No stress, just want to get to the bottom of it

    Did you disable traces with uGoLive or editing the config file for security?

    There should be a larger block for that error in the trace which includes the function path, though it looks like it's finding and calling the method correctly, but for some reason the type that's being tested it's not finding an overload for.

    Could you perhaps try upgrading to 4.7.1.1? Maybe I updated the overloads

     

  • Paul Kaplan 86 posts 139 karma points
    Jan 20, 2012 @ 00:28
    Paul Kaplan
    0

    Hi again,

    I didn't knowingly disable tracing.

    Is upgrading to 4.7.1.1 from 4.7.1 simply a matter of drag/dropping the contents of tbe "build" folder on to my existing 4.7.1 installation?  Of course I would back it up first!

    I need to demo it next week thus don't want to lose any work.

    I need to unwind from jury duty (hopefully tomorrow is last day), so won't get to Umbraco until this weekend.

    -- Paul

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 20, 2012 @ 01:32
    Gareth Evans
    0

    bin, umbraco and umbraco_client.

    But, be careful that you might need to hand merge umbracoSettings

    Also, theres a small change that means stuff that automatically comes back as int might break, but there's a config setting you can apply to fix

     

  • Paul Kaplan 86 posts 139 karma points
    Jan 20, 2012 @ 20:43
    Paul Kaplan
    0

    OK back from jury duty, upgraded to 4.7.1.1.  Here goes (please let me know if this isn't what you're looking for):

    Pagedata loaded for Gra-GnvRentalCars (ID: 1145) 0.000472965139424145 0.000185
    umbracoPage Looking up skin information 0.000508165143893987 0.000035
    aspx.page End PreInit 0.000848711218883964 0.000341
    aspx.page Begin Init 0.000873854079219566 0.000025
    renderMacro Rendering started (macro: , type: 6, cacheRate: 0) 0.000912965195297168 0.000039
    umbracoMacro MacroEngine script added () 0.00100459695296469 0.000092
    umbracoMacro Loading IMacroEngine script 0.00102638743192221 0.000022
    Resolve Urls 0 0.00158092718487964 0.000555
     RazorDynamicNode got datatype 5e9b75ae-face-41c8-b47e-5f4b0fd82f83 for rentalCarName on Gra-GnvRentalCar 0.00209356217061107 0.000513
     Checking for a RazorDataTypeModel for data type guid 5e9b75ae-face-41c8-b47e-5f4b0fd82f83... 0.00212066058675055 0.000027
     Checking the RazorDataTypeModelTypes static mappings to see if there is a static mapping... 0.00213909868432999 0.000018
     There isn't a staticMapping defined so checking the RazorDataTypeModelTypes cache... 0.00216675583069915 0.000028
     GUID 5e9b75ae-face-41c8-b47e-5f4b0fd82f83 does not have a DataTypeModel, falling back to ConvertPropertyValueByDataType 0.00219692726310187 0.000030
    Resolve Urls 0 0.00223212726757172 0.000035
     RazorDynamicNode got datatype 5e9b75ae-face-41c8-b47e-5f4b0fd82f83 for rentalCarPhone on Gra-GnvRentalCar 0.00225475584187376 0.000023
     Checking for a RazorDataTypeModel for data type guid 5e9b75ae-face-41c8-b47e-5f4b0fd82f83... 0.00227542886037192 0.000021
     Checking the RazorDataTypeModelTypes static mappings to see if there is a static mapping... 0.002292749497492 0.000017
     There isn't a staticMapping defined so checking the RazorDataTypeModelTypes cache... 0.00231398124621984 0.000021
     GUID 5e9b75ae-face-41c8-b47e-5f4b0fd82f83 does not have a DataTypeModel, falling back to ConvertPropertyValueByDataType 0.00233912410655544 0.000025
    umbracoMacro Error Loading Razor Script (file: ) The best overloaded method match for 'umbraco.library.StripHtml(string)' has some invalid arguments    at CallSite.Target(Closure , CallSite , Type , Object )
      at ASP._Page_App_Data_TEMP_Razor_inline_e50d20b38d3a936580e075b2314a0662_cshtml.Execute() in c:\Inetpub\wwwroot\umbraco\App_Data\TEMP\Razor\inline-e50d20b38d3a936580e075b2314a0662.cshtml:line 7
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 22, 2012 @ 20:54
    Gareth Evans
    0

    Okay I'll test and see what happens, Everything looks right and the type should be coming back as HtmlString which means one of those overloads should apply

Please Sign in or register to post replies

Write your reply to:

Draft