Handle StringFormat() exceptions in case of malformed string format to avoid causing unhandled exception crashes (cherry picked from commit c79811de4fbf2b22cd74f55853516c7fc307055f)