Incompatible Web Part markup detected

For months the Webpart could be installed through a solution/feature without any problems. Then I had to change something in the code. When I tried to upgrade the solution to see the changes, the Webpart could not be added to a page anymore.

The assembly is deployed to the GAC through the solution. It has been upgraded.

Looking at the xml file in my solution did not show any errors. It looks fine.

The features deployed a .webpart in the Webpart catalog. That looks fine as well.

So what caused the error?

The Webpart class had a “XmlRoot” attribute. After I removed it, everything worked as I expected it.

XmlRoot belongs to the Xml serializer, which will serialize your class if needed. “Controls XML serialization of the attribute target as an XML root element.”