Hey Charlie,
This issue has come up a few times with myself during development. I am unsure as the root cause but have a solution.
I believe the issue may be because the output you are setting in your plugin (probably an EntityCollection) isn't build around the Early Bound objects, and although your object extends from the base Entity class, it still isn't classified as an "Entity" when being set.
In order to resolve, all I've had to do is convert the object(s) I'm setting to the base Entity structure.
var role = new xxx_prescriberrole();
var entityRole = role.ToEntity();
If you have an Entity Collection you are trying to set:
var roles = new List();
var entityRoles = new EntityCollection();
roles.ForEach(r => entityRoles.Add(r.ToEntity()));
You may also be able to just cast your Early Bound object instead of calling the ToEntity method:
var role = new xxx_prescriberrole();
var entityRole = (Entity)role;
If you have more questions please feel free to reach out.
If this solved your issue I appreciate you liking and marking this as answered.
Thanks!
Matt Bayes