Copied to clipboard

Flag this post as spam?

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


  • frank-frank 22 posts 45 karma points
    Nov 15, 2010 @ 17:05
    frank-frank
    0

    System.OverflowException: Value was either too large or too small for an Int32

    System.OverflowException: Value was either too large or too small for an Int32

    Hi,

    the error is thrown when I try to save my xslt.
    I'd like to understand HOW umbraco comes up with this error while saving the xslt? At this point it wouldn't even know what my xml input will be, so..., why is this error thrown?

    (some forum people say 'just to ignore the error and force a save to file but that doesn't work and I am getting a live error then */

    Especially disturbing is that my xslt file works on my development maschine but not on the hosted live version which has an identical umbraco installation. The only thing I am not controlling is the rest of the live environment. So my question is also: what exactly happens in the background when umbraco 'saves' the xslt?

     

    Here's a simplified version of a xslt statement sequence in my xslt file which will ultimately lead to the exception:

    <xsl:variable name="navidB" select="string(my_NaviItemInternalLink)"/> /* with or without 'string' makes no difference */
    <xsl:value-of select="$navidB"/>                      /* test print out: 1168 */


    <xsl:variable name="navidA" select="1168"/>
    <xsl:variable name="navidTestA" select="umbraco.library:NiceUrl($navidA)"/>    /* works */

    if I now modify the above line and use $navidB instead of $navidA then I am getting the error...


    <xsl:variable name="navidTestB" select="umbraco.library:NiceUrl($navidB)"/>    /* throws error:  System.OverflowException: Value was either too large or too small for an Int32.

    WHY IS THAT ERROR THROWN ? */
                     

    === my xml would look like this ===

    <nodeA id=999 creator=.... etc.>

       <my_NaviItemInternalLink>1168</my_NaviItemInternalLink>

    </nodeA>

    === full error for your reference: ===
    System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ToInt32(Double value)
    at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, IList`1 parent)
    at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     

  • Ian Smedley 97 posts 192 karma points
    Nov 15, 2010 @ 17:23
    Ian Smedley
    1

    The reason is that it trys to execute your xslt, but as you pointed out, it doesn't know what your XML is going to be, there is no $currentPage set - it is throwing the error because NiceUrl expects a value (which it won't have on a save)

    Best practise would probably say to handle the exception of not having a $currentPage or NodeId set..

    <xsl:if test="$navidB != ''">
    // Code Here
    </xsl:if>

    I guess that by trying to run your XSLT, it will pick up most syntactical errors, before you save and potentially break working XSLT, the best way is to try and run it before saving..

     

  • frank-frank 22 posts 45 karma points
    Nov 15, 2010 @ 18:05
    frank-frank
    0

    Hello Ian,

    perfect, thanks for explaining!

    It works now.

  • Daniel Dutton 3 posts 23 karma points
    Mar 05, 2012 @ 10:18
    Daniel Dutton
    0
       
Please Sign in or register to post replies

Write your reply to:

Draft