How to static scan all C # code for argument errors in string format

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

One of the problems is that only at runtime we get an error if the string format parameters, such as {0}, {1}, {2}, have the correct count of method parameters.

Many of these methods are called only when errors occur that rarely or never occur during automated testing.

So, is there any tool that can scan all C # code and notify about problems with string formats?

NOTE. Here I see many other questions when statically analyzing code that duplicates, but after looking at some of these tools they seem to be unable to cope with this particular situation.

IF there is nothing really good for this, we will write this tool ourselves.

+6
source share
2 answers

We are using VS2012. The code analysis tool built into it helped us identify all of these problems.

+2
source

Source: https://habr.com/ru/post/928135/


All Articles