Examples of errors detected by the V3038 diagnostic

V3038. The argument was passed to method several times. It is possible that another argument should be passed instead.


SharpDevelop

V3038 The first argument of 'Replace' function is equal to the second argument. - ADDITIONAL IN CURRENT ReflectionDisassembler.cs 349


void
WriteSecurityDeclarationArgument(CustomAttributeNamedArgument na)
{
  ....
  output.Write("string('{0}')",
    NRefactory.CSharp.TextWriterTokenWriter.
    ConvertString((string)na.Argument.Value).Replace("'", "\'"));
  ....
}

Correct version: Replace("'", "\\'") There is exactly the same bug in the 'Xamarin.Forms' project.


Xamarin.Forms

V3038 The first argument of 'Replace' function is equal to the second argument. ICSharpCode.Decompiler ReflectionDisassembler.cs 349


void WriteSecurityDeclarationArgument(
         CustomAttributeNamedArgument na)
{
  ....
  output.Write("string('{0}')",
    NRefactory.CSharp
              .TextWriterTokenWriter
              .ConvertString(
                (string)na.Argument.Value).Replace("'", "\'"));
  ....
}

There is exactly the same bug in the 'SharpDevelop' project.



Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;