Merge "Instead of asserting return a runtime error if the maximum sample size cannot be determined." into gingerbread