Wednesday, January 5, 2011

Fixing Bugs

As code change some areas, I've worked on bug fixing.
One part of code that was sensible to copy/paste behavior is this template:
if (_solverOptionsView.cbxDetectParallelLines.IsChecked != null)
Data.SetValue(2, _solverOptionsView.cbxDetectParallelLines.IsChecked.Value);
As we use C# 3.0 (part of VS 2008 or newer) we can use one of its features to make the code better (?? operator):
Data.SetValue(2, _solverOptionsView.cbxDetectParallelLines.IsChecked ?? false);

Mostly bugs were in areas like, but not limited to:
- invalid shapes will not break too much on new code parts. This had some impact on "edge cases" that give some invalid data (for example circle with radius 0 will break Solver edge intersection, because Solver will try to extract the bounding box). A similar crash was with zero length Point to point
- rectangle defined with colinear coordinates will not crash NaroCAD.
- parallel line and edge continuation match position preview line coordinates at wrong positions or with wrong orientation
- added quality of service code on edge intersection code

No comments: