A new paradigm for in-line detection and control of patterning defects