Hello devs of the internet!
The Winforms.DataVisualization.Charting.Chart draws itself as a big red cross if the axes or displayed points take values they should not have.
This happens when an exception occurs inside the OnPaint method. Other questions to this topic advise to make a subclass and override OnPaint. That's what i did and thats how i found out what caused the problem.
The interesting question is: How to i get rid of this error state? I tried settig the properties to valid values and clearing all content, calling Invalidate() and the usual things. The OnPaint method is never called again after the error occured.
Is there some kind of behaviour in winforms that leads to this? Can controls be flagged as "failed beyond recover"? When i move controls above the failed state chart, the red x is redrawn, so it is painted, but not by itself.
I wonder which kind of detail knowledge i am missing here.
PS: SetStyle does not help, OnPaint is called before the error happens and imlementing it does not solve it.
Appendix A: Recompiling I disassembled the source code of the whole Winforms.DataVisualization.Charting assembly and recompiled it. By commenting out the throw; in the charts OnPaint, there method does not leave with an expection but just draws an "error has occured"-image itself. In this case, the repainting is not disabled forever.
Somehow it looks like Winforms removed controls from the drawing order if they throw an exception.