Application Crashing when tring to Load the XSLT file  
Author Message
RonakPPatel





PostPosted: XML and the .NET Framework, Application Crashing when tring to Load the XSLT file Top

Hi,

We have Borland c++ applicaiton which is calling .Net 2.0 Plugin which has
XML Transformation implemented. This application crashed when it tries to execute
XslCompiledTransfomation's Load action. I even tried to put global try and catch block to get the exception. But it seems like some vierd thing goes while executing the Load action and even the execption is not caught.

Here is my Code.


XPathDocument myXPathDoc = new XPathDocument(xmlFile);


XslCompiledTransform myXslTrans = new XslCompiledTransform();


try
{
MessageBox.Show("Start Loading Xslt file");
myXslTrans.Load(xsltFile);
MessageBox.Show("Lode does work");
}
catch (Exception ee)
{
MessageBox.Show("Load :" + ee.Message);
}


XsltArgumentList xslArgs = new XsltArgumentList();

xslArgs.AddParam("discount","","10 Jan 2006");

XmlTextWriter myWriter = new XmlTextWriter(htmlFile, null);

myXslTrans.Transform(myXPathDoc, xslArgs, myWriter);
myWriter.Close();


In above code i can get message upto "Start loading Xslt file"....
Things i have figured out : There should be some issue between Borland C++ and .net 2.0
This code works fine if i just put it into simple console application. Even it works perfectly fine if i call my Plugin from another .Net applicatioin. It is crashes when i am calling it from Borland C++ applicaiton.

Waiting for your prompt responses.




.NET Development7  
 
 
Martin Honnen





PostPosted: XML and the .NET Framework, Application Crashing when tring to Load the XSLT file Top

With .NET 2.0 and XslCompiledTransform the Load method of XslCompiledTransform loads the XSLT stylesheet and compiles it to .NET (MSIL)code. As your .NET specific code and your stylesheet, as far as I understand your post, work flawlessly if run in a pure managed .NET application I am not sure what to suggest as changes in terms of .NET and/or XML.

 
 
Chris Lovett





PostPosted: XML and the .NET Framework, Application Crashing when tring to Load the XSLT file Top

Does the following work

myXslTrans.Load(myXPathDoc);

What is the actual Exception message and call stack (print ee.ToString()). Does the XSLT contain script code If so, it might be a permissions problem depending on how the C++ host sets up the CLR AppDomain. If it is a sand-boxed AppDomain then it won't work because XSLT compilation requires full trust. If you don't trust the plugin but you do trust the XSLT, the you could move the compilation (Load) to a separate trusted plugin and leave the execution to the sand-boxed appdomain.



 
 
-Anton Lapounov





PostPosted: XML and the .NET Framework, Application Crashing when tring to Load the XSLT file Top

Hello Ronak,

It's hard to help you without knowing exact exception information. Attaching the de**** may help you to catch the exception.

Thanks,
Anton


 
 
RonakPPatel





PostPosted: XML and the .NET Framework, Application Crashing when tring to Load the XSLT file Top

Hi Guys,

Sorry for late reply. I found the solution to above problem.

http://groups.google.com/group/microsoft.public.dotnet.framework.interop/browse_thread/thread/f764f9342057d78f/8bc221247a3fd79d lnk=st&q=xslt+compile+transformation+problem+in+c%23&rnum=5&hl=en#8bc221247a3fd79d


Please read above link carefully. Basically the transform operation throws the Floating Point error which i am truning off before execution this function and truning on after wards. This is one of the know bug between Borland c++ and c#.