The lib3mf makes the assumption that the resourceList is ordered.
This is not correct.
I attached a 3mf that was generated using microsoft 3dbuilder that breaks this code generating a id that already exists.
Box.zip
The problem here is that the package resource id and generateResourceID() are not in sync and this becomes an issue when models start with id 2 (seems to be the case with microsoft builder) instead of 1.
The lib3mf makes the assumption that the resourceList is ordered. This is not correct. I attached a 3mf that was generated using microsoft 3dbuilder that breaks this code generating a id that already exists. Box.zip