Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved Issue related to Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero. #39

Open
javipriego opened this issue Oct 11, 2018 · 0 comments

Comments

@javipriego
Copy link

javipriego commented Oct 11, 2018

Hi NivNavick.

I get your code to generate html from my trx and i had an issue related to :

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at System.Xml.Xsl.CompiledQuery.Script1.RemoveAssemblyName(String asm)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (6)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome, IList1 testsFailedSet, IList1 testsFailedCount, IList1 classSet, IList1 classCount)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (4)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 classCount, IList1 classSet, IList1 testsFailedCount, IList1 testsFailedSet, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (3)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (2)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
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,
st`1 {urn:schemas-microsoft-com:xslt-debug}namespaces)
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, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(String inputUri, String resultsFile)
at TrxerConsole.Program.Transform(String fileName, XmlDocument xsl)
at TrxerConsole.Program.Main(String[] args)

It was solved updating only the file txer.xslt in the rott of your project. To solve overwrite your RemoveAssemblyName method by this one:


public string RemoveAssemblyName(string asm)
    {
      if(asm.IndexOf(',')>0) {
        return asm.Substring(0,asm.IndexOf(','));
      }
      else 
      {
        return asm;
      }
    }

Consider to add this change to your last merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant