Вопрос

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.

Это было полезно?

Решение

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

Другие советы

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top