Failed to render control: An error occurred during a call to extension function 'createMonthUrl'.

Topics: Enhanced Blog Edition
Jul 8, 2008 at 10:34 PM
Edited Jul 9, 2008 at 3:38 AM
Has anyone seen this problem with CKS:EBE?
"Failed to render control: An error occurred during a call to extension function 'createMonthUrl'. "

It looks like the archive control cannot render for a specific month?


There are only posts in February and July. While the control seems to render February fine, it seems to have a problem with July (doesn't show it, but instead the error)?

Strangly enough another theme seems to work:

Jul 10, 2008 at 10:33 PM
Can you run up DebugView (from technet) and post the results? This should give us the inner exception.

Jul 14, 2008 at 7:29 PM
thanks for the hint to DebugView!

Here is the output:
[4784] System.Xml.Xsl.XslTransformException: An error occurred during a call to extension function 'createMonthUrl'. See InnerException for a complete description of the error. ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
[4784] Parameter name: length
[4784]    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
[4784]    at CKS.EBE.DefaultUrlProvider.createMonthUrl(String postDate)
[4784]    at CKS.EBE.XslMethods.createMonthUrl(String postDate)
[4784]    --- End of inner exception stack trace ---
[4784]    at System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args)
[4784]    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
[4784]    at <xsl:template match="row">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
[4784]    at <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
[4784]    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
[4784]    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
[4784]    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
[4784]    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
[4784]    at CKS.EBE.WebControls.XslTransformation.Render(HtmlTextWriter writer)
Jul 15, 2008 at 7:59 PM
Hi Folks,

I happened to hit this today as well, though not in quite the same circumstances, I'm sure its the same bug. I have not been able to drill into it in detail, however this may help:

1) I can reproduce the issue by creating a blog post that starts with 2 integers, eg. 11111111

The section of code being complained about is here:
            else if (sPartial.StartsWith("/archive/"))
                int res = 0;
                if (int.TryParse(sPageName.Substring(0, 2), out res))
                    RewriteMonthUrl(siteUrl, context, oWeb, sPageName.Substring(0, 2), siteUrl.Segments[siteUrl.Segments.Length - 2].Substring(0, 4));
                    RewritePostUrl(siteUrl, context, oWeb);

Vince, I think you will be able to spot the problem a lot quicker than I could.

Let me know if I can help,
Jul 15, 2008 at 9:47 PM
Thanks Dan and Rookie

I'll have a look and see if I can re-produce it.

Jul 16, 2008 at 8:09 PM
Edited Jul 16, 2008 at 8:35 PM

I can reproduce the issue:

I created a blog post with a Windows Mobile blogging client through the Metaweblog API which ended up to have the status "PENDING" and an emtpy "PUBLISHED" date field.
bad post This post ("Test from windows mobile") caused the above problem. As soon as I delete the post, everything works fine again.

The issue seems to be that the mobile blogging client i am using (TBlogger) does specify the date of the post in the format, while Sharepoint expects it to be mm/dd/yyyy. This causes the post to appear without any date and this seems to be causing the problem with the CreatheMonthURL method.

Oct 17, 2008 at 9:30 PM
I ran into this issue earlier.

This is because while creating a post item, Published date is not created.

When I set the published date as below:

newItem["Published"] = System.DateTime.Now;

Then, this error gone away. 

If you still find error, then the problem could be with Approval Status, because the status is Pending for all the items created unless we execute following statement:

newItem.ModerationInformation.Status = SPModerationStatusType.Approved;

- Sai Krishna

Dec 13, 2009 at 2:46 PM