(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.