Debugging tips for SharePoint developers – Nasty Exception from HRESULT: 0x80040E2F

This really had me going for a while. I got this really weird problem the other night. I was setting up a metadata based document library with three SharePoint lookup lists. Basically there are three metadata columns that have lookup fields to other lists. The site owner needs to add new items on the metadata lists, so a Lookup column was the only sensible choice.

The three metadata lists, let’s call them A, B, and C, are initially only simple custom list like lists, so I decided to save some time and just create a simple ListTemplate and copy the schema to all the lists. Then I have a separate feature with ListInstances to create instances off these ListTemplates. Fairly simple, I do that all the time.

However, something really strange happened when I activated the list instance feature. The feature would throw an exception (Exception from HRESULT: 0x80040E2F) and remain deactivated, but the first list instance would be created. On the second attempt, the same thing would happen but the second list would be created. Feature still remaining deactivated. The third time everything was working and the third and final list would be created and the feature activated.

The ListInstance element was really simple:

Names and guid replaced with proper values, of course.

My good friend Sahil Malik pointed me in the direction of this article which explains the exact same symptoms and proposes that the problem is related to missing Id attributes in the ListInstance elements. However, adding Id attributes didn’t solve the problem, so I was back to square zero.

Long story short, the problem was that in copying the ListTemplate schema.xml files I also copied the Name attribute. Big mistake. Changing the Name attributes of the List element in the schema.xml file solved the whole problem. A day after I started… Dang.

Well, now I know. And so do you.

.b

Found this article valuable? Want to show your appreciation? Here are some options:

a) Click on the banners anywhere on the site to visit my blog's sponsors. They are all hand-picked and are selected based on providing great products and services to the SharePoint community.

b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.

c) Spread the word! Below, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!

Pin It

Published by

Bjørn Furuknap

I previously did SharePoint. These days, I try new things to see where I can find the passion. If you have great ideas, cool projects, or is in general an awesome person, get in touch and we might find out together.

Leave a Reply

Your email address will not be published.