开发者

JIT Compiler encountered an internal limitation. VS2008

I've been using XslCompiledTransform because Microsoft tells me I need to use as XslTransform is deprecated.

<ExactDatetime>200-02-02</ExactDatetime>) works using XslTransform

<ExactDatetime>200-02-02</ExactDatetime>) fail using XslCompiledTransform

<ExactDatetime></ExactDatetime>) works using XslTransform

Works:

XslTransform xslDoc = new XslTransform(); 
xslDoc.Load(xslPath); 
xslDoc.Transform(doc, Response.Output); 

Fails with JIT (When use date example 200-02-02)

XslCompiledTransform xslDoc = new XslCompiledTransform(); 
xslDoc.Load(xslPath); 
xslDoc.Transform(doc, new XmlTextWriter(Response.Output)); 

JIT Compiler encountered an internal limitation.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidProgramException: JIT Compiler encountered an internal limitation.

Source Error:

Line 33:            //xslDoc.Transform(doc, Response.Output); 
Line 34: 
Line 35:             xslDoc.Transform(doc, new XmlTextWriter(Response.Output)); 
Line 36:         } 
Line 37:   } 

Source File: c:\shahid\ccr_test\test1\Default.aspx.cs Line: 35

Stack Trace:

[InvalidProgramException: JIT Compiler encountered an internal limitation.] 
   <xsl:template name="date:_format-date">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, IList`1 year, IList`1 month, IList`1 day, IList`1 hour, IList`1 minute, IList`1 second, IList`1 timezone, IList`1 pattern) +0 
   <xsl:template name="date:format-date">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator date-time, XPathNavigator pattern) +5170 
   <xsl:template match="DateT开发者_开发技巧ime" name="dateTime">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 dt, XPathNavigator fmt) +12397 
   <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) +46057 
   Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) +91 
   Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) +28 
   System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) +88 
   System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter) +193 
   System.Xml.Xsl.XmlILCommand.Execute(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) +28 
   System.Xml.Xsl.XslCompiledTransform.Transform(String inputUri, XmlWriter results) +81 
   _Default.Button1_Click(Object sender, EventArgs e) in c:\shahid\ccr_test\test1\Default.aspx.cs:35 
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 


I had the same problem, and I think it was the same stylesheet (CCR).

The problem was the compiled XSLT denying access to the document() function, and not properly dealing with the error. On the XslCompiledTransform.Load() call, pass in an XsltSettings object that allows for use of the document function. Something like this:

myTransform.Load(filename,XsltSettings.TrustedXslt,new XmlUrlResolver());


It looks like the format-date function is blowing up on an invalid date value in a way that it didn't do before. Without knowing more details it's hard to theorize on the cause. Are you importing EXSLT libraries or using the ones built into MSXML?

Either way you may need to wrap these calls with a utility function that validates the values before calling format-date in order to prevent the exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜