I've found the stable reference methodology in the Api to be a bit cumbersome, but overall hassle free.
What I've done is the following and it works (although I don't know what exactly is in the SideFaces array):
IList<Reference> sideFaces = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior);
if (!references.Contains(sideFaces[0]))
references.Add(sideFaces[0]);
Note that I made a list of references rather than a ReferenceArray. The purpose is that I can address a list better than a reference array.
I then added the references to the array ra as follows:
foreach (Reference f in references)
{
ra.Append(Reference.ParseFromStableRepresentation(doc, f.ConvertToStableRepresentation(doc)));
}
This will get me the faces of the wall / outside layers of the wall in a reference array. This solved my problem that I couldn't alter the references of the dimensions placed by my API.
To broaden the context of my solution: I'm creation ModelCurves at points in my project that I want to dimension, then use an Intersect filter to see what walls are hitting with it perpendicularly, get the faces references, and use them in a ReferenceArray in the way that I described.
My only problem is that I have to start and commit a Transaction to place the Curve, before I can use the Curve for my interference filter. If there is a more elegant way to obtain the same result in a single transaction then I'd be very happy.