I have written a method to find broken references and to fix them, if the correct file was found.
The replacement I am doing with ModelDoc2.ReplaceReferencedDocument as you can see in the snapshot.
The referencedDoc comes from another method which searches all broken references in the referencingDoc by ModelDoc.GetDependencies.
My Problem is now, that sometimes it works, but sometimes it doesn't, even if referencingDoc und newReferencedDoc exists.
When it doesnt work, the ReplaceReferenceDocument method Returns null, but gives no clue why it doesnt worked.
Someone has an idea what can be the Problem?
Thanks for ur help.