Fixed ImplementedInterfaces are not always of type CodeInterface. Linq changed from Cast to OfType