Not quite what I was expecting. I thought you might just return zero if there was an invalid assignment and it was the only assignment or you would return the count of valid assignments.
Did you do this because you expect us to manage any invalid assignments? For example, you mentioned that MS Project will remove the invalid assignment (if available) and add a new assignment as part of the add routine.
BTW: Doesn't the Reader already know if the Assignment is valid or not by attempting to locate a resource object. In this case, Invalid = no resource object (this is my temporary work around).
The Primavera files might be quite revealing when you look at them. I don't believe they include a Resource with UID = 0. They do not include any assignments (rather than 1 invalid assignments).
I've actually tested the Primavera files using MS Project 2002 - they actually open and look fine (given some data might not be converted correctly).
So, at this point, I'll probably not use this function as long as I can be sure that an invalid assignment has a resource object = nothing.
(I'm looking forward to the next release!!)