If you are like me, creating lots of SharePoint web parts - you must have seen this hundreds of times.
See my old post on this issue: unable to add selected web part(s)
It does not give you any useful information as to what went wrong, you cannot debug it and basically you were blind folded to resolve this issue on your own.
What if I tell you, that there is a way to get the internal error message that will let you know exactly what you did wrong in code, DWP, or anywhere else?
Well, as I have learned today - there is such a way, and it is rather simple.
First, you have to make sure your server shows complete error messages and not these nice custom error page. Simply edit your web.config (back it up first!) and change CallStack="false" to CallStack="true", and also change the
Now, you install your web part, try to add it to a web part page and boom – this happens…
The trick is, to go to site collection settings -> Galleries -> Web parts and find your web part definition there.
Once found – click on the file name link to get a detailed error page with stack trace and everything!
Note, that you will get a complete error message the first time:
And the same limited information all other times:
So be sure to keep the error page open first time until you got all the info you need!
Strange, but at least we got something!