Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Runtime detected an invalid program

From: lynn parsons@-----------.---------.---
To: NULL
Date: 12/11/2006 10:25:00 PM

I am transforming xml using the following function:

        private static string transform(string xml, XsltArgumentList xslArg)
        {
            XslCompiledTransform xslt = new XslCompiledTransform();
            xslt.Load(new XmlTextReader(new 
MemoryStream(ASCIIEncoding.Default.GetBytes(Resource1.MacObjectToApi3))));
            StringBuilder result = new StringBuilder();
            StringReader sr = new StringReader(xml);

            XmlReaderSettings settings = new XmlReaderSettings();
            XmlReader reader = XmlReader.Create(sr, settings);

            xslt.Transform(reader, xslArg, new StringWriter(result));
            return result.ToString();
        }

I am running Windows 2003 and .Net 3.0.

I get the following error:

System.InvalidProgramException was unhandled
  Message="Common Language Runtime detected an invalid program."
  Source="System.Xml.Xsl.CompiledQuery.1"
  StackTrace:
       at <xsl:template match="/">(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.ExecuteDelegate.Invoke(XmlQueryRuntime 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, 
Boolean closeWriter)
       at System.Xml.Xsl.XmlILCommand.Execute(XmlReader contextDocument, 
XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
       at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, 
XsltArgumentList arguments, TextWriter results)
       at XsltConsoleApplication.Program.transform(String xml, 
XsltArgumentList xslArg) in C:\Documents and Settings\Administrator\My 
Documents\Visual Studio 
2005\Projects\XsltConsoleApplication\XsltConsoleApplication\Program.cs:line 42
       at XsltConsoleApplication.Program.Main(String[] args) in C:\Documents 
and Settings\Administrator\My Documents\Visual Studio 
2005\Projects\XsltConsoleApplication\XsltConsoleApplication\Program.cs:line 23
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

The XSLT is fairly large.  I have found by trial and error that I can remove 
various <xsl:if test=".."> tests and get it to work.

Any idea what is causing the invalid program error or how to track it down?


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent