There was it, again, the sandbox game…
After creating a SilverLight webpart as a sandbox solution, and changing some names and namespaces there, the whole thing crashed, with the "WebPartPageUserException: The type is not registered as safe." exception.
I have looked at the .webpart file –> check.
I have looked at the .cs file –> check.
I have even looked at the Elements.xml –> check.
And then, the moment of enlightening – of course, I have again forgotten the "SharePointProjectItem.spdata" file. That neat little file, residing hidden in your project structure, needs to be adapted as well.
First click on the "Show all files" in solution explorer to display all of the files in the folders, regardless if they officially belong to the solution or not:
Then locate the "SharePointProjectItem.spdata", which should be in the same location as your webpart files:
Open it, and locate the namespace – there is the problem, usually:
And, voilà, no error message anymore!