System.OverflowException: Value was either too large or too small for an Int32
Hi.
I have a problem when trying to display and save XSLT Macros. I have attempted to upgrade from Umbraco
4.0.3 to 4.5.2 then to 4.71. Installation between the former two went
well. I also managed to upgrade from 4.5.2 to 4.7.1 initially, or so I
thought, without problem.I took two
copies of the live site and database and got it running locally before I did
any work. I.e., local.sitebackup1 and local.sitebackup2.Both point to the same database but the first
is used for upgrade 4.5.2 and the second for 4.7.1.Site 4.52 correctly displays the XSLT macros
on the home page whereas site 4.7.1 doesn’t.It did originally but I went on lunch, came back and it was broke.When I run the page in debug mode, I get the
following stack trace.
Value was
either too large or too small for an Int32.
Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
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 System.Xml.Xsl.CompiledQuery.Query.<xsl:template
match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime,
XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double
{urn:schemas-microsoft-com:xslt-debug}position, Double
{urn:schemas-microsoft-com:xslt-debug}last, IList`1
{urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\umbraco
upgrades\NF4\xslt\header.xslt:line 66
at
System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime
{urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double
)
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime
{urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime
{urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument,
XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable
input, XsltArgumentList arguments, TextWriter results)
at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML,
XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model,
Hashtable pageElements)
What is
interesting to note, is that I get the same stack trace when trying to save an
already valid XSLT file in the 4.7.1 umbraco back-end. It just won’t save.Neither however will style-sheets.However, in version 4.5.2 umbraco backend they
will save and I am not presented with such an error.I have checked permissions etc., trawled
through config settings but can’t seem to find a solution.Can anyone help this Umbraco newby??Could it be a problem using the same database
whilst testing both versions.
The error itself is due to a non-numerical value being passed through to an extension method. Not sure what sure what you are trying to call, but it's on line 66 of "header.xslt". This can be resolved by wrapping an <xsl:if> condition around the call, lets say if you are calling NiceUrl, then you can do this...
Another question that has sprung to mind about your upgrade, in your "config\umbracoSettings.config" file, check the value of the "UseLegacyXmlSchema" option. If it is set to "True", then you'd either need to set it to "False" (because your old v4.0.x install would have used the legacy XML schema), or you'd need to modify all your XSLT templates to use the new schema. Obviously easiest option is to set it back to "False".
Lee. Thank you for your prompt reply. It was really appreciated.
I have only been working with Umbraco for a few weeks so, thought id try a few other things before having a go with your solution as i'v not quite mastered XSLT yet. Quite simply, when following upgrade instructions when it said publish the site, I assumed it referred to clicking on the content tab and selecting republish entire site. Instead, I selected the actual root content nodes within the content folder, right clicked and selected publish then publish Home and all its subpages. This took a while but after publishing was complete, all XSLT displayed correct. This was also with useLegacyXmlSchema property set to true.
System.OverflowException: Value was either too large or too small for an Int32
Hi. I have a problem when trying to display and save XSLT Macros. I have attempted to upgrade from Umbraco 4.0.3 to 4.5.2 then to 4.71. Installation between the former two went well. I also managed to upgrade from 4.5.2 to 4.7.1 initially, or so I thought, without problem. I took two copies of the live site and database and got it running locally before I did any work. I.e., local.sitebackup1 and local.sitebackup2. Both point to the same database but the first is used for upgrade 4.5.2 and the second for 4.7.1. Site 4.52 correctly displays the XSLT macros on the home page whereas site 4.7.1 doesn’t. It did originally but I went on lunch, came back and it was broke. When I run the page in debug mode, I get the following stack trace.
Value was either too large or too small for an Int32.
Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) 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 System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\umbraco upgrades\NF4\xslt\header.xslt:line 66 at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double ) at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
What is interesting to note, is that I get the same stack trace when trying to save an already valid XSLT file in the 4.7.1 umbraco back-end. It just won’t save. Neither however will style-sheets. However, in version 4.5.2 umbraco backend they will save and I am not presented with such an error. I have checked permissions etc., trawled through config settings but can’t seem to find a solution. Can anyone help this Umbraco newby?? Could it be a problem using the same database whilst testing both versions.
Hi Daniel,
The error itself is due to a non-numerical value being passed through to an extension method. Not sure what sure what you are trying to call, but it's on line 66 of "header.xslt". This can be resolved by wrapping an <xsl:if> condition around the call, lets say if you are calling NiceUrl, then you can do this...
Another question that has sprung to mind about your upgrade, in your "config\umbracoSettings.config" file, check the value of the "UseLegacyXmlSchema" option. If it is set to "True", then you'd either need to set it to "False" (because your old v4.0.x install would have used the legacy XML schema), or you'd need to modify all your XSLT templates to use the new schema. Obviously easiest option is to set it back to "False".
Cheers, Lee.
Lee. Thank you for your prompt reply. It was really appreciated.
I have only been working with Umbraco for a few weeks so, thought id try a few other things before having a go with your solution as i'v not quite mastered XSLT yet. Quite simply, when following upgrade instructions when it said publish the site, I assumed it referred to clicking on the content tab and selecting republish entire site. Instead, I selected the actual root content nodes within the content folder, right clicked and selected publish then publish Home and all its subpages. This took a while but after publishing was complete, all XSLT displayed correct. This was also with useLegacyXmlSchema property set to true.
Thanks again for taking the time to look at this.
Cheers, Daniel
is working on a reply...