Backports fix from 7 for GetDimensions call to ensure the file exists