Better exception when serializing a collection that have the wrong element types