Question

We have thousands of different log messages coded using the log4net library and string format method calls.

One problem with this is that it's only at run time that we get an error if the string format parameters like {0}, {1}, {2} have the right count of method parameters.

Many of these methods only get called on error conditions that rarely or never occur during automated testing.

So is there any tool that can scan all C# code and notify of any string format problems?

NOTE: I see many other questions on here at static code analysis which appears duplicate but after looking at some of those tools, they don't seem to handle this specific situation.

IF nothing really good for this, we'll write this tool in-house.

Was it helpful?

Solution

We're using VS2012. The code analysis tool built into it helped us identify all of those types of issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top