Minecraft wiki entry for Detector_Rail, associated text: A comparator can read the contents of a minecart with hopper or with chest on a detector rail through a solid opaque block, as it can with other container blocks.