System.Diagnostics.Debug.Print and current culture RRS feed

  • General discussion

  • Hi,

    in my culture settings (German), the "," is used as the decimal separator and the "." to group numbers. If I execute this code

          Debug.Print("{0:#,##0}", 1234)
          Debug.Print(String.Format("{0:#,##0}", 1234))

    the output is


    Even though the documentation of Debug.Print says, it calls String.Format, it obviously doesn't use the current culture. Do you think this is intentionally or a bug?


    • Changed type Armin Zingler Saturday, April 4, 2015 2:49 PM No answer possible, asking for opinion
    Saturday, April 4, 2015 2:08 PM

All replies

  • I looked at the code for Debug.Print(String, Object()) in Reference Source. It does indeed call String.Format, but when it does so, it specifies the InvariantCulture as the culture to use. The documentation for Debug.Print says that it uses the "composite formatting feature" of the .Net Framework. It doesn't say anything one way or the other about culture. I could argue that the invariant culture is the appropriate one to use for debugging purposes. I would say this is a case of inadequate documentation rather than a bug.
    Saturday, April 4, 2015 2:44 PM
  • Thanks Blackwood. Nothing I could add to this. :)

    (I've change the thread type to discussion as I was actually asking for comments and am not looking for a solution.)


    Saturday, April 4, 2015 2:51 PM