String constants cannot be checked if the constant field is accessed by some other class. The compiler does copy the string constants directly to the location where they are used. Since the reference to the original constant is lost there is no way to find out who depends on a specific string constant. This can be surprising for people who change constants for the next release of their assembly and find that all previously compiled code does still use the old constant. But all is not lost. When your string constant is sufficiently unique you can directly search for a substring of your string constant of all ldstr tokens. This is exactly what the -whousesstring command does. Since string constants can be combined to form new constants a substring match is the default to find all possible combinations.


-WhousesString "substring" defining assemblies -in <using file/s> -word -case
-ws "substring" defining assemblies -in <using file/s> -word -case

defining assemblies is optional and defines the root assembly from where the string constant originates. This does limit the search to assemblies which do actually reference the assembly that does define the constant.

<using file/s> are the assemblies that are searched for using the string constant
-word Do a exact string match
-case Do a case sensitive match


ApiChange -ws null -in $net2 -excel

Excel output

Last edited Jun 4, 2010 at 10:08 PM by Alois, version 2


No comments yet.