If u have ever used “dynamic” keyword in your webpart code,its 100% possibility you will meet this error.
Its because using dynamic operation in same appdomain as sharepoint is not supported in new LegacyCASModel.
So heres a workaround i did to make it work:
if you wrote a timerjob, edit owstimer.config otherwise edit web.config:
Instead of this:
<trust level=”Full” originUrl=”” legacyCasModel=”true” />
<trust level=”Full” />
and add this to <configuration><runtime>:
Hope it helps