Does this help?

http://geekswithblogs.net/jonasb/archive/2007/03/05/108023.aspx

On 3 February 2011 15:42, Greg Keogh <g...@mira.net> wrote:

>  Back to coding ... I diagnosed an app crash today caused by an argument
> to string.Format having curly braces inside it. I was doing something like 
> string.Format("Report
> title: {0}", title) where title was the string "{Intention}" and I'm told
> this is a perfectly acceptable title.
>
>
>
> We all know that you have to escape braces by doubling them in the
> arguments, but at what point in an app do you guard against this crash?
> Today it was way up in the UI, several months ago I had the same crash way
> down in a server logging method. The moderate sized app I'm working on today
> has 366 string.Format calls scattered all through it at different levels,
> some in a Silverlight app and some on the server side. How on earth do you
> globally guard all these calls without making a coding mess? I haven't found
> an obvious elegant solution yet. Has anyone else considered this problem?
>
>
>
> Sure I could wrap string.Format calls in an another function or create a
> string extension method that doubles braces in the arguments, but it seems
> clumsy.
>
>
>
> Greg
>

Reply via email to