public void DrawLine(Pen pen, Point pt1, Point pt2)
{
if (pen == null)
throw new ArgumentNullException ("pen");
// DrawLine is throwing an assertion error on MonoTouch
// Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y))
// , function void CGPathAddLineToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat)
// What we will do here is not draw the line at all if any of the points are Single.NaN
if (!float.IsNaN(pt1.X) && !float.IsNaN(pt1.Y) &&
!float.IsNaN(pt2.X) && !float.IsNaN(pt2.Y))
{
MoveTo (pt1.X, pt1.Y);
LineTo (pt2.X, pt2.Y);
StrokePen (pen);
}
}