views:

74

answers:

1

(This question has been cross-posted on the MSDN forums here.)

I'm working on a custom SharePoint/Commerce Server site, and I have a custom feature which is designed to do two things: provision some pages through modules, and provision a list of checkout steps, using the CheckoutStepsList template in a feature receiver. For some reason, though, in certain cases the list creation throws an exception:

Invalid file name

The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file.

When I try to navigate to the list, I'm brought to the list settings page (there should be a default view), and the list has 0 items in it. So it looks like it provisioned the list halfway, but crashed somewhere in the middle.

It's somewhat difficult to reproduce this issue. If I activate the feature through an stsadm command on the command line, it always fail, but if I do it through the SharePoint UI, sometimes it fails, and sometimes it doesn't. Crashing through the UI seems to happen more often if the pages being provisioned through the modules don't exist yet, but I'm not sure of that yet.

Here's the offending code:

SPListTemplateCollection listTemplateCollection = web.Site.GetCustomListTemplates(web);
SPListTemplate checkoutStepsTemplate = listTemplateCollection["CheckoutStepsTemplate"];
Guid listID = web.Lists.Add(listName, String.Empty, checkoutStepsTemplate); // the exception is thrown on this line

Any idea what's going on here? I'll keep debugging this on my end, and I'd be happy to provide any information that may help diagnose the issue.

A: 

I never found a full solution to this issue, but I did diagnose enough of the issue that we found an acceptable workaround. It turns out that the problem only occurred when provisioning elements through modules in the same feature, but when those modules are included in a different feature, everything worked fine.

We decided to move on for now, so that's as far as I got in finding the root cause of the issue, but it's at least a good enough fix that it won't cause us headaches in the future.

Jonathan Schuster