If you add four storage objects, then delete the last one some of the previous elements loose their childrne.
The following test shows this bug.
[TestMethod]
public void Test_CompoundFile_Delete_ChildElementMaintainsFiles()
{
using (var compoundFile = new CompoundFile())
{
// Only works if d is the last storage added.
// Works if four elements exist, middle element persists.
var storage1 = compoundFile.RootStorage.AddStorage("b");
var storage2 = compoundFile.RootStorage.AddStorage("c");
var storage3 = compoundFile.RootStorage.AddStorage("a");
var storage4 = compoundFile.RootStorage.AddStorage("d");
storage1.AddStream("A.1");
compoundFile.RootStorage.Delete("d");
storage1 = compoundFile.RootStorage.GetStorage("a");
storage1.GetStream("A.1");
}
}
It is expected not to fail, but A.1 is not found.
The example provided IS expected to fail: in your code stream A.1 is added to storage b, not to storage a where you are trying to retrive it.
Please, let me know if I've misunderstood your post.
Best Regards,
Federico
My apoligies there.
A bug where the symptoms suggested in the test did occur, but this is a bad test (and I jumped the gun on posting it).
I will look for the case where it actually looses children, this one is fine.
Thank you for pointing that out.