Hi,
The reason is that there is a permission check when accessing the child documents like this. It basically requests the given documents and then counts them, but this should not be possible because you could access also other properties which might be a security issue.
There is a web.config key which disables this security check, but its better to use the code above in this case.
Kind regards,
Richard Sustek