Custom preview: "Data conversion failed from Goo to Shader"

I’d like to visualize some grasshopper geometry with color. The Custom Preview component works perfectly fine when using the Create Material component to create the material. But I would like to create my own materials, that is, have a Python component that outputs a list of geometries and a list of materials that can be connected to the Custom Preview component . Unfortunately, when I create a Rhino.Display.DisplayMaterial object and feed it into the M input of the Custom Preview component, it complains that “Data conversion failed from Goo to Shader”. Although both objects are of type DisplayMaterial, the Create Material output works fine, while mine throws an error. What am I doing wrong or what do I have to watch out for? I also tried with Human, but realized that the Modify Object Attributes component only works with Rhino geometries, not Grasshopper geometries. The only alternative that I can think off is to use meshes (Ladybug/Honeybee successfully colors meshes), but that only works for breps, not lines.

I found the solution in Rhino 6 Grasshopper render preview materials

I created an mMaterial component in Python almost a year ago: