Topics: ObjectBuilder
Sep 14, 2007 at 10:23 AM
I haven't tried it but by looking at the code I can clearly see that if the ParentLocator of the innerLocator is null, it would throw an ArgumentNullException instead of simply returning null as per the contract of IReadableLocator.

I think it should check for null first.
Sep 15, 2007 at 12:29 PM
Sorry, perhaps the name of "ReadOnlyLocator" doesn't clearly express what it does. It wraps and existing readable locator and ensures that it can only be read. It's like calling ".AsReadOnly()" on one of the built-in containers in .NET.
Sep 15, 2007 at 1:35 PM
It is quite clear to me. I was just saying it should respect IReadableLocator contract.

IReadableLocator locator = new Locator();

locator = new ReadOnlyLocator(locator);
Assert.IsNull(locator.ParentLocator); //Will throw ArgumentNullException when it should Assert successfully.
Sep 15, 2007 at 6:15 PM
Ah, you're right. I mis-read your original post. This is a bug.

Sep 15, 2007 at 7:07 PM
I've fixed this in the ObjectBuilder project used by the CodePlexContainer sample in change set 26886: