Use Debug fail method

image_pdfimage_print
   

using System;
using System.Collections;
using System.Diagnostics;

class Class1 {
   static void Main(string[] args) {
     Debug.Fail("Fail Message", "An unexpected exception has been thrown.

");
   }
}