Hi,
I've just had a look and I'm not sure what is wrong with your specific code. Your code seems to work fine with solid colliders (eg. box, etc), but doesn't seem to work properly with edge colliders, and is reproducible with any old box with edge colliders applied by hand. You should probably look into unity forums / answers about edge colliders and raycasts to see if there are any known issues like this / if there are any solutions.