Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the...

Examples of errors detected by the V3005 diagnostic

V3005. The 'x' variable is assigned to itself.


StabilityMatrix

V3005 The 'this.modelIndexService' variable is assigned to itself. InferenceFluxTextToImageViewModel.cs 63


private readonly IModelIndexService modelIndexService;

public InferenceFluxTextToImageViewModel(
                      IServiceManager<ViewModelBase> vmFactory,
                      IInferenceClientManager inferenceClientManager,
                      INotificationService notificationService,
                      ISettingsManager settingsManager,
                      RunningPackageService runningPackageService)
{
  this.notificationService = notificationService;
  this.modelIndexService = modelIndexService;  // <=

  SeedCardViewModel = vmFactory.Get<SeedCardViewModel>();
  SeedCardViewModel.GenerateNewSeed();

  ModelCardViewModel = vmFactory.Get<UnetModelCardViewModel>();
}

Unity C# reference source code

V3005 The 'this.defaultHasBeenPrevented' variable is assigned to itself. EventDebuggerTrace.cs 42


public bool propagationHasStopped { get; }
public bool immediatePropagationHasStopped { get; }
public bool defaultHasBeenPrevented { get; }

public EventDebuggerCallTrace(IPanel panel, EventBase evt,
                              int cbHashCode, string cbName,
                              bool propagationHasStopped,
                              bool immediatePropagationHasStopped,
                              long duration,
                              IEventHandler mouseCapture): base(....)
{
  this.callbackHashCode = cbHashCode;
  this.callbackName = cbName;
  this.propagationHasStopped = propagationHasStopped;
  this.immediatePropagationHasStopped = immediatePropagationHasStopped;
  this.defaultHasBeenPrevented = defaultHasBeenPrevented;
}

TowerDefense-GameFramework-Demo

V3005 The 'transform.localPosition' variable is assigned to itself. Item.cs 150


public void OnRecycle()
{
  transform.SetParent(initRoot, false);
  transform.localPosition = transform.localPosition;
  transform.eulerAngles = initRotation;
  transform.localScale = initScale;
  ....
}

nopCommerce

V3005 The 'priceModel.OldPriceValue' variable is assigned to itself. ProductModelFactory.cs 503


protected virtual async Task
            PrepareSimpleProductOverviewPriceModelAsync(Product product,
                                                        .... priceModel)
{
  ....

  if (product.IsRental)
  {
    //rental product
    priceModel.OldPrice = await _priceFormatter
                                  .FormatRentalProductPeriodAsync(....);

    priceModel.OldPriceValue = priceModel.OldPriceValue;

    priceModel.Price = await _priceFormatter
                               .FormatRentalProductPeriodAsync(....);

    priceModel.PriceValue = priceModel.PriceValue;
  }

  ....
}

Similar errors can be found in some other places:

  • V3005 The 'priceModel.PriceValue' variable is assigned to itself. ProductModelFactory.cs 505

GrandNode

V3005 The 'model.MetaKeywords' variable is assigned to itself. GetLessonHandler.cs 37


public async Task<LessonModel> Handle(....)
{
  var model = new LessonModel();
  var modelCourse = request.Course.ToModel(request.Language);

  model.Id = request.Lesson.Id;
  model.CourseId = modelCourse.Id;
  model.CourseDescription = modelCourse.Description;
  model.CourseName = modelCourse.Name;
  model.CourseSeName = modelCourse.SeName;
  model.MetaDescription = modelCourse.MetaDescription;
  model.MetaKeywords = model.MetaKeywords;                   // <=
  model.MetaTitle = model.MetaTitle;                         // <=
  model.Name = request.Lesson.Name;
  model.ShortDescription = request.Lesson.ShortDescription;
  model.Description = request.Lesson.Description;
  model.UserFields = request.Lesson.UserFields;
  ....
}

Discord.NET

V3005 The 'After' variable is assigned to itself. ThreadUpdateAuditLogData.cs 18


public class ThreadUpdateAuditLogData : IAuditLogData
{
  private ThreadUpdateAuditLogData(IThreadChannel thread,
                                   ThreadType type,
                                   ThreadInfo before,
                                   ThreadInfo after)
  {
    Thread = thread;
    ThreadType = type;
    Before = before;
    After = After;
  }
  ....
}

AvalonStudio

V3005 The 'RightMargin' variable is assigned to itself. VirtualTerminalController.cs 1446


public void SetCursorPosition(int column, int row)
{
  ....
  if (LeftAndRightMarginEnabled)
  {
    if (CursorState.OriginMode && CursorState.CurrentColumn < LeftMargin)
      CursorState.CurrentColumn = LeftMargin;
    if (CursorState.CurrentColumn >= RightMargin)
      RightMargin = RightMargin;                   // <=
  }
  ....
}

Barotrauma

V3005 The 'Penetration' variable is assigned to itself. Attack.cs 324


public Attack(float damage,
              float bleedingDamage,
              float burnDamage,
              float structureDamage,
              float itemDamage,
              float range = 0.0f,
              float penetration = 0f)
{
   ....
   Range = range;
   DamageRange = range;
   StructureDamage = LevelWallDamage = structureDamage;
   ItemDamage = itemDamage;
   Penetration = Penetration;                // <=
}

Barotrauma

V3005 The 'arrowIcon.PressedColor' variable is assigned to itself. ChatBox.cs 164


public ChatBox(GUIComponent parent, bool isSinglePlayer)
{
  ....
  arrowIcon = new GUIImage(....)
  {
    Color = new Color(51, 59, 46)
  };
  arrowIcon.HoverColor = arrowIcon.PressedColor =
  arrowIcon.PressedColor = arrowIcon.Color;
  ....
}

DotNetNuke

V3005 The 'this.SuppressTokenReplace' variable is assigned to itself. SendTokenizedBulkEmail.cs 109


public SendTokenizedBulkEmail(List<string> addressedRoles,
                              List<UserInfo> addressedUsers,
                              bool removeDuplicates,
                              string subject,
                              string body)
{
  this.ReportRecipients = true;
  this.AddressMethod = AddressMethods.Send_TO;
  this.BodyFormat = MailFormat.Text;
  this.Priority = MailPriority.Normal;
  this._addressedRoles = addressedRoles;
  this._addressedUsers = addressedUsers;
  this.RemoveDuplicates = removeDuplicates;
  this.Subject = subject;
  this.Body = body;
  this.SuppressTokenReplace = this.SuppressTokenReplace; // <=
  this.Initialize();
}

DotNetNuke

V3005 The 'comp.Value.Description' variable is assigned to itself. SitemapBuilder.cs 231


private static void LoadProviders()
{
  ....
  foreach (KeyValuePair<string, SitemapProvider> comp in
             ComponentFactory.GetComponents<SitemapProvider>())
  {
    comp.Value.Name = comp.Key;
    comp.Value.Description = comp.Value.Description;
    _providers.Add(comp.Value);
  }
  ....
}

QuantConnect Lean

V3005 The '_factory' variable is assigned to itself. ZipEntryNameSubscriptionDataSourceReader.cs 50


private readonly SubscriptionDataConfig _config;
private readonly DateTime _date;
private readonly bool _isLiveMode;
private readonly BaseData _factory;

public ZipEntryNameSubscriptionDataSourceReader(
    SubscriptionDataConfig config,
    DateTime date,
    bool isLiveMode)
{
  _config = config;
  _date = date;
  _isLiveMode = isLiveMode;
  _factory = _factory = config.GetBaseDataInstance(); // <=
}

Chocolatey

V3005 The 'Provider' variable is assigned to itself. CrytpoHashProviderSpecs.cs 38


public abstract class CrytpoHashProviderSpecsBase : TinySpec
{
  ....
  protected CryptoHashProvider Provider;
  ....
  public override void Context()
  {
    Provider = Provider = new CryptoHashProvider(FileSystem.Object);
  }
}

Emby

V3005 The '_validProviderIds' variable is assigned to itself. BaseNfoParser.cs 77


private Dictionary<string, string> _validProviderIds;
....
public void Fetch(....)
{
  ....
  _validProviderIds = _validProviderIds = new Dictionary<....>(....);
  ....
}

OpenCvSharp

V3005 The 'optimumChannels[PixelFormats.Indexed1]' variable is assigned to itself. WriteableBitmapConverter.cs 22


static WriteableBitmapConverter()
{
  optimumChannels = new Dictionary
                    <PixelFormat, int>();
  optimumChannels[PixelFormats.Indexed1] =         // <=
  optimumChannels[PixelFormats.Indexed8] =         // <=
  optimumChannels[PixelFormats.Gray2] =
  optimumChannels[PixelFormats.Gray4] =
  optimumChannels[PixelFormats.Gray8] =
  optimumChannels[PixelFormats.Gray16] =
  optimumChannels[PixelFormats.Gray32Float] =
  optimumChannels[PixelFormats.Indexed1] =         // <=
  optimumChannels[PixelFormats.Indexed2] =
  optimumChannels[PixelFormats.Indexed4] =
  optimumChannels[PixelFormats.Indexed8] =         // <=
  ....
  optimumTypes = new Dictionary
                 <PixelFormat, MatType>();
  optimumTypes[PixelFormats.Indexed1] =            // <=
  optimumTypes[PixelFormats.Indexed8] =            // <=
  optimumTypes[PixelFormats.Gray2] =
  optimumTypes[PixelFormats.Gray4] =
  optimumTypes[PixelFormats.Gray8] =
  optimumTypes[PixelFormats.Indexed1] =            // <=
  optimumTypes[PixelFormats.Indexed2] =
  optimumTypes[PixelFormats.Indexed4] =
  optimumTypes[PixelFormats.Indexed8] =            // <=
  optimumTypes[PixelFormats.BlackWhite] =
  ....
}
....
public static class PixelFormats
{
  ....
  public static PixelFormat Indexed8 { get; }
  ....
  public static PixelFormat Indexed1 { get; }
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'optimumChannels[PixelFormats.Indexed8]' variable is assigned to itself. WriteableBitmapConverter.cs 23
  • V3005 The 'optimumTypes[PixelFormats.Indexed1]' variable is assigned to itself. WriteableBitmapConverter.cs 50
  • V3005 The 'optimumTypes[PixelFormats.Indexed8]' variable is assigned to itself. WriteableBitmapConverter.cs 51

Azure PowerShell

V3005 The 'this.LastHeartbeat' variable is assigned to itself. PSFabricDetails.cs 804


public ASRInMageAzureV2SpecificRPIDetails(
  InMageAzureV2ReplicationDetails details)
{
  this.LastHeartbeat = this.LastHeartbeat;  // <=
  this.RecoveryAvailabilitySetId = details.RecoveryAvailabilitySetId;
  this.AgentVersion = details.AgentVersion;
  this.DiscoveryType = details.DiscoveryType;
  ....
}

public DateTime? LastHeartbeat { get; set; }

public class InMageAzureV2ReplicationDetails :
  ReplicationProviderSpecificSettings
{
  ....
  [JsonProperty(PropertyName = "lastHeartbeat")]
  public DateTime? LastHeartbeat { get; set; }
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'this.ResourceGroupName' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 84
  • V3005 The 'this.ExpressRouteGatewayName' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 85
  • V3005 The 'this.Name' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 86

Azure PowerShell

V3005 The 'this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent' variable is assigned to itself. SetAzureVMOperatingSystemCommand.cs 298


public override void ExecuteCmdlet()
{
  ....
  // OS Profile
  this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent =
    this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent;
  ....
}

[JsonProperty(PropertyName = "provisionVMAgent")]
public bool? ProvisionVMAgent { get; set; }

SubtitleEdit

V3005 The 'positionInfo' variable is assigned to itself. WebVTT.cs 79


internal static string GetPositionInfoFromAssTag(Paragraph p)
{
  ....
  if (!string.IsNullOrEmpty(line))
  {
    if (positionInfo == null)
      positionInfo = " line:" + line;
    else
      positionInfo = positionInfo += " line:" + line;
  }
  ....
}

PascalABC.NET

V3005 The 'e' variable is assigned to itself. generics.cs 430


public static type_node determine_type(....)
{
  ....
  try
  {
    return ....;
  }
  catch(Exception e)
  {
    e = e;
  }
  ....
}

PascalABC.NET

V3005 The 'miGenerateRealization.Visible' variable is assigned to itself. VisualPascalABCNET OptionsManager.cs 342


public void UpdateUserOptions()
{
  ....
  tsViewIntellisensePanel.Visible =
  .... =
  miGenerateRealization.Visible =
  miGenerateRealization.Visible =
  ....;
}

Similar errors can be found in some other places:

  • V3005 The 'visitNode' variable is assigned to itself. SyntaxVisitors SimplePrettyPrinterVisitor.cs 106

MSBuild

V3005 The '_nextProjectId' variable is assigned to itself. LoggingService.cs 325


public int NextProjectId
{
  get
  {
    lock (_lockObject)
    {
      _nextProjectId = _nextProjectId += MaxCPUCount + 2;  // <=
      return _nextProjectId;
    }
  }
}

Old NASA World Wind (C#)

V3005 The 'num1' variable is assigned to itself. PlaceFinder.cs 2011


public static bool SearchForAddress(....)
{
  double num1;
  long2 = num1 = 0;
  long1 = num1 = num1;  // <=
  lat2  = num1 = num1;  // <=
  lat1 = num1;
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'num1' variable is assigned to itself. PlaceFinder.cs 2012

WPF samples by Microsoft

V3005 The 'clipboardInfo.Text' variable is assigned to itself. MainWindow.cs 204


private void DumpAllClipboardContentsInternal()
{
  ....
  if (dataObject == null)
  {
    clipboardInfo.Text =
      clipboardInfo.Text =
        "Can't access clipboard now!
          \n\nPlease click Dump All Clipboard
              Contents button again.";
  }
  else
  {
     ....
}

Xenko

V3005 The 'hashCode' variable is assigned to itself. SiliconStudio.Xenko ParameterKeys.cs 346


public ParameterComposedKey(ParameterKey key,
                            string name,
                            int indexer)
{
  Key = key;
  Name = name;
  Indexer = indexer;

  unchecked
  {
    hashCode = hashCode = Key.GetHashCode();
    hashCode = (hashCode * 397) ^ Name.GetHashCode();
    hashCode = (hashCode * 397) ^ Indexer;
  }
}

Sony ATF

V3005 The 'window.Top' variable is assigned to itself. Atf.Gui.Wpf.vs2010 DockPanel.cs 707


public double Top  { get; set; }

public void ApplyLayout(XmlReader reader)
{
  ....
  FloatingWindow window = new FloatingWindow(
                                this, reader.ReadSubtree());
  ....
  window.Left = window.Left;
  window.Top = window.Top;
  ....
}

Sony ATF

V3005 The 'window.Left' variable is assigned to itself. Atf.Gui.Wpf.vs2010 DockPanel.cs 706


public double Left { get; set; }

public void ApplyLayout(XmlReader reader)
{
  ....
  FloatingWindow window = new FloatingWindow(
                                this, reader.ReadSubtree());
  ....
  window.Left = window.Left;
  window.Top = window.Top;
  ....
}

Sony ATF

V3005 The 'ProgressError' variable is assigned to itself. Atf.Gui.Wpf.vs2010 StatusService.cs 24


public ProgressCompleteEventArgs(Exception progressError,
                                 object progressResult,
                                 bool cancelled)
{
  ProgressError = ProgressError;
  ProgressResult = progressResult;
  Cancelled = cancelled;
}

.NET Compiler Platform ("Roslyn")

V3005 The 'Name' variable is assigned to itself. AsynchronousOperationListener.DiagnosticAsyncToken.cs 32


public DiagnosticAsyncToken(
  AsynchronousOperationListener listener,
  string name,
  object tag,
  string filePath,
  int lineNumber)
  : base(listener)
{
  Name = Name;
  Tag = tag;
  FilePath = filePath;
  LineNumber = lineNumber;
  StackTrace = PortableShim.StackTrace.GetString();
}

IronPython and IronRuby

V3005 The 'd["latin1"]' variable is assigned to itself. StringOps.cs 1905


private static Dictionary<string, EncodingInfoWrapper>
  MakeCodecsDict() {
  ....
  switch (normalizedName) {
    case "iso_8859_1":
      d["8859"] = d["latin_1"] = d["latin1"] =
      d["iso 8859_1"] = d["iso8859_1"] = d["cp819"] =
      d["819"] = d["latin"] = d["latin1"] = d["l1"] =
      encs[i];
      break;
  ....
}

MonoDevelop

V3005 The 'iconMargin.IsVisible' variable is assigned to itself. MonoDevelop.HexEditor HexEditor.cs 241


void OptionsChanged (object sender, EventArgs e)
{
  gutterMargin.IsVisible = Options.ShowLineNumberMargin;
  iconMargin.IsVisible = iconMargin.IsVisible;
  ....
}

public bool IsVisible { get; set; }

MonoDevelop

V3005 The 'this.WhiteSpaceText' variable is assigned to itself. ICSharpCode.NRefactory.CSharp WhitespaceNode.cs 65


public WhitespaceNode(string whiteSpaceText,
                      TextLocation startLocation)
{
  this.WhiteSpaceText = WhiteSpaceText;
  this.startLocation = startLocation;
}

public string WhiteSpaceText { get; set; }

MonoDevelop

V3005 The 'MarkCharacter' variable is assigned to itself. Mono.TextEditor ViMark.cs 45


public ViMark (char markCharacter) {
  MarkCharacter = MarkCharacter;
}

public char MarkCharacter {get; set;}

MonoDevelop

V3005 The 'MacroCharacter' variable is assigned to itself. Mono.TextEditor ViMacro.cs 57


public ViMacro (char macroCharacter) {
  MacroCharacter = MacroCharacter;
}

public char MacroCharacter {get; set;}

SharpDevelop

V3005 The 'this.WhiteSpaceText' variable is assigned to itself. WhitespaceNode.cs 65


public WhitespaceNode(string whiteSpaceText,
                      TextLocation startLocation)
{
  this.WhiteSpaceText = WhiteSpaceText;
  this.startLocation = startLocation;
}

Lower case 'w' should have been used instead of capital 'W'. Correct variant: this.WhiteSpaceText = whiteSpaceText;


SharpDevelop

V3005 The 'linearGradientBrush.GradientStops' variable is assigned to itself. BrushEditor.cs 120


void DetermineCurrentKind()
{
  ....
  else if (Brush is LinearGradientBrush) {
    linearGradientBrush = Brush as LinearGradientBrush;
    radialGradientBrush.GradientStops =
      linearGradientBrush.GradientStops;
    CurrentKind = BrushEditorKind.Linear;
  }
  else if (Brush is RadialGradientBrush) {
    radialGradientBrush = Brush as RadialGradientBrush;
    linearGradientBrush.GradientStops =      // <=
      linearGradientBrush.GradientStops;     // <=
    CurrentKind = BrushEditorKind.Radial;
  }
}

Most likely this is what should be written here: linearGradientBrush.GradientStops = radialGradientBrush.GradientStops;


Umbraco

V3005 The 'member.UpdateDate' variable is assigned to itself. MemberService.cs 114


public void SavePassword(IMember member, string password)
{
  ....
  member.RawPasswordValue = result.RawPasswordValue;
  member.LastPasswordChangeDate = result.LastPasswordChangeDate;
  member.UpdateDate = member.UpdateDate;
}

Similar errors can be found in some other places:

  • V3005 The 'user.UpdateDate' variable is assigned to itself. UserService.cs 269