public TestInfo(IDrawableObject drawableObject) { DrawableObject = drawableObject; //After the font class started to derive from the sprite class each font object we create calls a testinfo object which uses a font.So it leads to infinitive loop(stackoverflowexception) if (DrawableObject.GetType().Name != "Font") { Font = new Font(text: DrawableObject.GetType().Name); Font.SetLayerDepth(DrawableObject.LayerDepth + 0.1f); } }