Everyone is biased towards in-context references. Some find them an easy to update a component without leaving the assembly mode, others do not like because they can be easily break the assembly.
I’m interested in hearing some of you folks’ examples of out-of-context references issues and how you fixed them.
Remove them as soon as possible! But seriously I do use them to design with but they have a huge impact on performance. Honestly I will lock the references when I’m done doing the prototypeing, unlock them if I need to make changes, and break them when it’s time for releasing the package. Reference management definitely takes some practice.
Steel Designer Pro SOLIDWORKS Add-In uses in-context references for placing all library items. There are probably more than 500 in my current model. We also use components linked to assembly file properties. With proper discipline and technique they do not cause any issues or slow downs. It is certainly not for novices to attempt.
There are several reasons for out-of-context, such as renamed files, dangling references, suppressed components, unloaded fils etc. I would start by calling IModelDocExtension::GetDependencies with the ListBrokenRefs option set to True and then trying to figure out why the reference is broken and fix the cause (e.g. replace relation with the new entity), not a trivial task IMHO.
ISwDMExternalReferenceOption2 and ISwDMSearchOption:: SearchFilters property might be helpful. But I am not sure you can fix the broken reference through DM especially if referenced entity is deleted or modified.
One thing I would like to highlight that fixing broken references in in-context design manually alone is a challenging work. Fixing it through API is going to be even more challenging.