Examples of errors detected by the V3005 diagnostic
V3005. The 'x' variable is assigned to itself.
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
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;
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;
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;}
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 '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 '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; }
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;
....
}
.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();
}
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;
}
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 '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;
....
}
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;
}
}
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
{
....
}
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
MSBuild
V3005 The '_nextProjectId' variable is assigned to itself. LoggingService.cs 325
public int NextProjectId
{
get
{
lock (_lockObject)
{
_nextProjectId = _nextProjectId += MaxCPUCount + 2; // <=
return _nextProjectId;
}
}
}
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
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;
}
....
}
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;
}
....
}
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; }
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
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
Emby
V3005 The '_validProviderIds' variable is assigned to itself. BaseNfoParser.cs 77
private Dictionary<string, string> _validProviderIds;
....
public void Fetch(....)
{
....
_validProviderIds = _validProviderIds = new Dictionary<....>(....);
....
}
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);
}
}
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(); // <=
}
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);
}
....
}
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();
}
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;
....
}
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; // <=
}
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; // <=
}
....
}
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;
}
....
}
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;
....
}