The problem is that you are not calling the overload you are thinking about. You call Debug.WriteLine(string, string) , which uses the first parameter as a message and the second as a category, not a format argument.
The easiest way to fix this is to pass the object argument to force it to use Debug.WriteLine(string, params object[]) overload:
Debug.WriteLine("Queued batch item: {0}", (object) bm.BatchName);
A slightly longer approach, but one that is perhaps more object-oriented, is to explicitly create an array:
Debug.WriteLine("Queued batch item: {0}", new object[] { bm.BatchName });
Or (just to save delivery parameters :) call string.Format explicitly to cause Debug.WriteLine(string) to overload:
Debug.WriteLine(string.Format("Queued batch item: {0}", bm.BatchName));
or when you simply include the argument directly at the end:
Debug.WriteLine("Queued batch item: " + bm.BatchName);
Alternatively, you can create your own convenience method that does not have an additional, useless (in your case) overload.
source share