Custom List form loading error “Error while executing web part: System.StackOverflowException: Operation caused a stack overflow”

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/20523

I have a custom list with around 250+ columns.

I have customized the new, edit and display forms of the list. I used more xsl templates to display all the columns in DataFormWebPart.

But after some updates of SharePoint, my new form is returning to error page.

MetadataNavigationContext Page_InitComplete: No XsltListViewWebPart was found on this page["custom form URL"].  Hiding key filters and downgrading tree functionality to legacy ListViewWebPart(v3) level for this list.

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.    
 at Microsoft.Xslt.NativeMethod.CheckForSufficientStack()    
 at <xsl:template name="dvt_1.rowedit">(XmlQueryRuntime , XPathNavigator , Double , Double )    
 at <xsl:template name="dvt_1.body">(XmlQueryRuntime , XPathNavigator , Double , IList`1 )    
 at <xsl:template name="dvt_1">(XmlQueryRuntime , XPathNavigator , Double )    
 at Root(XmlQueryRuntime )    
 at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)    
 at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)    
 at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results)    
 at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)    
 at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)

This issue is being observed after august updates. Please help me....

有帮助吗?

解决方案

I also ran into this error message when upgrading a 2007 site to 2010. A custom list had a custom edit form. There are about 150 fields in this list. It appears the error message is caused by the time it takes the DataFormWebPart to render out the content.

You can find some details of the error here on TechNet.

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/ad13e5e4-e211-453f-bfef-fe260591154a

In the OP, the stack trace is located at CheckForSufficientStack(). The code below was posted by the thread above after looking into the assemblies with reflector to see what that method is doing...

public static unsafe void CheckForSufficientStack()
{
    void* stackBarrier = StackBarrier;
    if (dateTime < DateTime.Now)
    {
        throw new StackOverflowException();
    }
    if (&stackBarrier < stackBarrier)
    {
        throw new StackOverflowException();
    }
} 

and back in SP1...

public static unsafe void CheckForSufficientStack()
{
    void* stackBarrier = StackBarrier;
    if (((++callCount & 0xffff) == 0) && (dateTime.AddSeconds(5.0) < DateTime.Now))
    {
        throw new StackOverflowException();
    }
    if (&stackBarrier < stackBarrier)
    {
        throw new StackOverflowException();
    }
}

So SP1 added a check that if it takes > 5 seconds, throw the Exception. Now, I believe that time has been reduced to a SINGLE SECOND. So if it takes more than a second to render your content (and that's likely with 100 fields), you'll get this exception.

I have been able to work around this issue by way of InfoPath.

I am positive if you were to comment out in the markup for the DataFormWebPart, all but just 10 or so fields, you won't have any errors...Uncomment the rest, and the issue will return.

其他提示

Microsoft has released a posibility to modify the xslt-timeout in their latest CU. There you can modify the XsltTimeOut:

$farm = Get-SPFarm
$farm.XsltTransformTimeOut = 5
$farm.Update()

We attempted to use BCS and found that the response rate for queries over 10 records was inordinately slow versus what logic tells you should be the response rate for queries. We have since banned the use of BCS in our SharePoint environment and favor WebApi JSON for data requests. It is orders of magnitude faster and more flexible.

You can simply the custom xsl by removing fields like FieldDescription. This fixed the issue for me. My page has more than 80 controls.

I get the same issue however when I refresh the page it goes away.

Almost seems like a caching issue to me.

My situation: I customized the XSLT on the XsltListViewWebPart web part. As soon as I make a change to the xsl the error comes back and when I hit the page again it goes away.

The best way to work around this issue is the following:

1.) Sub class the DataForm Web Part. Override the following methods. Then Deploy the assembly. Example:

public class customDFWP : DataFormWebPart
     {
         public override bool IsGhosted
         {
             get
             {
                 return true;
             }
         }
         public override bool CanHaveServerControls
         {
             get
             {
                 return true;
             }
         }
     }

2.) Add a safe control entry to the web.config Example:

<SafeControl Assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" Namespace="customDFWP" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="False"/>

3.) Add the following to the element of the web.config Example:

<add tagType="Microsoft.SharePoint.WebPartPages.DataFormWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" mappedTagType="customDFWP.customDFWP, customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" />

4.) Register the assembly on the form page. Example:

<%@ Register tagprefix="customDFWP" namespace="customDFWP" assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" %>

5.) On the form page find and replace it with the new custom tag.Example:

<customDFWP:customDFWP>

This is described in the following KB-article: http://support.microsoft.com/kb/2639184

I have the same issue. Sharepoint log tells more:

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.     at Microsoft.Xslt.NativeMethod.CheckForSufficientStack()     at <xsl:apply-templates mode="Lookup_body">(XmlQueryRuntime , XPathNavigator , XPathNavigator )     at <xsl:template match="FieldRef" name="FieldRef_PrintField" mode="PrintField">(XmlQueryRuntime , XPathNavigator , XPathNavigator , Double , String )     at <xsl:apply-templates mode="PrintFieldWithECB">(XmlQueryRuntime , XPathNavigator , XPathNavigator )     at <xsl:template match="FieldRef" name="FieldRef_printTableCell_EcbAllowed" mode="printTableCellEcbAllowed">(XmlQueryRuntime , XPathNavigator , XPathNavigator , String )     at <xsl:template match="Row" mode="Item">(XmlQueryRuntime , XPathNavigator , IList`1 , IList`1 , Double... f02b0a05-b76e-4b91-8587-c70ca13d2011
10/04/2011 13:56:25.96* w3wp.exe (0x1084)                           0x14C8  SharePoint Foundation           Web Parts                       89a1    High        ... , Double )     at <xsl:template match="View" mode="RenderView">(XmlQueryRuntime , XPathNavigator )     at <xsl:template match="View" mode="full">(XmlQueryRuntime , XPathNavigator , String )     at <xsl:template match="View" name="View_Default_RootTemplate" mode="RootTemplate">(XmlQueryRuntime , XPathNavigator , String )     at <xsl:template match="/">(XmlQueryRuntime )     at Root(XmlQueryRuntime )     at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)     at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)     at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgu...  f02b0a05-b76e-4b91-8587-c70ca13d2011
10/04/2011 13:56:25.96* w3wp.exe (0x1084)                           0x14C8  SharePoint Foundation           Web Parts                       89a1    High        ...mentList arguments, XmlWriter results)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)   f02b0a05-b76e-4b91-8587-c70ca13d2011

The problem disappears when I limit elements in list from 1000 to 100.

许可以下: CC-BY-SA归因
scroll top