I have several custom webparts which i am attempting to add to a custom page WebPartZone using SPD2010.

I can successfully add one, however when i attempt to add the other i get an "Error Creating Control- Object reference not set to an instance of an object" error. I can however deploy my solution from VS and successfully add both webparts to the page in the browser UI with no errors.

The weird part is that both webparts are similar (when it comes to the code, one is roughly 80% of the other). Both are identical when it comes to getting the SPContext for the site and the web.

Any Ideas how i can find out whats going on?

1 Answer 1


I would recommend retracting both we parts and then making sure you remove them from web part gallery, which is usually not done when uninstalling. Just before redeploying, make sure each web part has its own unique name, namespace, and you give each a different id when creating their instance so there are no collisions. Custom editors also should have unique ids. As for your code, make sure you dispose objects properly and there are no concurrency issues. BTW VS usually activates features automatically. If you have event receivers you should check them. Your exception is usually due to trying to instantiate a web part or object that simply does not exist, so sanitise your code before using objects at will.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.