private static string FormatStringSafe(string fmt, params object[] args)
{
var ret = fmt;
if (args != null && args.Length > 0)
{
try
{
ret = string.Format(fmt, args);
}
catch (FormatException)
{
ret = string.Format("Error while formatting #{0}#!", fmt);
Debug.Assert(false, "Trace string did cause format Exception: #{0}#", fmt);
}
}
return ret;
}