(Rhinocommon Bug ?) TryGetCylinder does not return height

i have a Brep / Cylinder / Surface of Revolution - (internalized in attached gh file).
TryGetCylinder()
will find the radius and the plane, but the height is 0;
setting some default heights (0..10) the cylinder is showing.

what is wrong - do I expect to much from TryGetCylinder ?
I would claim it s a bug ?

thanks for having a look.

kind regards.

Tom

public class Script_Instance : GH_ScriptInstance
{
    private void RunScript(Brep brep, bool setDefaultH, ref object a, ref object h)
    {
        a = null;
        Cylinder cyl;
        if (!brep.Faces[0].TryGetCylinder(out cyl)) return;
        if (setDefaultH)
        {
            cyl.Height1 = 0;
            cyl.Height2 = 10;
        }
        // Write your logic here
        a = cyl.ToRevSurface();
        h = cyl.TotalHeight;
    }
}

tryGetCylinderBug_00.gh (7.1 KB)

EDIT:

workaround

use this function as workaround.
if you don’t like multiple returns / early returns you will not like the code.
if you have any other improvements - happy to read your comments.

private bool TryGetCylinderWithHeight(Surface srf, out Cylinder cylinder, double tolerance = 0.001)
    {
        cylinder = Cylinder.Unset;
        Cylinder cylinderBack;
        if (!srf.TryGetCylinder(out cylinderBack,tolerance)) return false;
        if (cylinderBack.TotalHeight < tolerance * 10)
        {
            Plane plane = cylinderBack.BasePlane;
            if (!plane.IsValid) return false;
            BoundingBox bbox = srf.GetBoundingBox(plane);
            if (!bbox.IsValid) return false;
            double h1 = bbox.Min.Z;
            double h2 = bbox.Max.Z;
            if (Math.Abs(h2-h1) < tolerance * 10) return false;
            cylinderBack.Height1 = h1;
            cylinderBack.Height2 = h2;
        }
        cylinder = cylinderBack;
        return true;
    }