LineRenderer BakeMesh is turning/rotating the line?

If I have a linerenderer that draws a line, the mesh I get after using the BakeMesh API results in a different looking line that looks like it has been rotated 90 degrees. Is there some way to get it to generate a mesh that looks exactly the same as I see it in the inspector?

To turn the line into a mesh, I’m using

    public static GameObject BakeLineDebuger(GameObject lineObj, Material m)
        var lineRenderer = lineObj.GetComponent<LineRenderer>();
        var meshFilter = lineObj.AddComponent<MeshFilter>();
        Mesh mesh = new Mesh();
        meshFilter.sharedMesh = mesh;

        var meshRenderer = lineObj.AddComponent<MeshRenderer>();
        meshRenderer.sharedMaterial = m;

        return lineObj;

@homer_3 Maybe there is another parameter for BakeMesh(mesh , camera)