NivNavick / trxer

Transforms trx file into html
105 stars 92 forks source link

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero. #11

Open Akankshaa-Agrawal opened 8 years ago

Akankshaa-Agrawal commented 8 years ago

trx file on VS2013 Not getting converted to HTML Below exception arised

C:\covertedFiles>"C:\Program Files (x86)\Trxer\TrxerConsole.exe" testResults1.trx Trx File testResults1.trx Loading xslt template... Loading css... Loading javascript... Transforming...

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. (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. (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. (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. (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.(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)

Menur commented 8 years ago

HI can you publish your .trx file which causes exception, i had also problem with 2013 VS #10

Akankshaa-Agrawal commented 8 years ago

PFA..

On Thu, Oct 22, 2015 at 3:47 PM, Menur notifications@github.com wrote:

HI can you publish your .trx file which causes exception, i had also problem with 2013 VS #10 https://github.com/NivNavick/trxer/issues/10

— Reply to this email directly or view it on GitHub https://github.com/NivNavick/trxer/issues/11#issuecomment-150169951.

ivip40 commented 8 years ago

I had the same issue. The problem is in the RemoveAssemblyName function. asm.IndexOf(',') returns -1 and this is invalid parameter for the Substring function.

sthirion commented 7 years ago

In the Trxer.xslt, change the method RemoveAssemblyName (on line 13) to: public string RemoveAssemblyName(string asm) { if(asm.IndexOf(',')>0) { return asm.Substring(0,asm.IndexOf(',')); } else {return asm;} }