private static string PlStringFormat(string text, params object[] ps) { RegisterCurrentThread(); try { if (ps != null && ps.Length > 0) { for (int i = 0; i < ps.Length; i++) { var o = ps[i]; if (o == null) { ps[i] = "NULL"; } else if (o is Exception) { ps[i] = PrologCLR.ExceptionString((Exception)o); } } text = String.Format(text, ps); } } catch (Exception) { } DeregisterThread(Thread.CurrentThread); return(text); }