Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ dotnet_diagnostic.CA1863.severity = suggestion
# CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
dotnet_diagnostic.CA1864.severity = warning

# CA1868: Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = warning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a corresponding entry to the .test.globalconfig file? That one would be at level none.


# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none

Expand Down
3 changes: 3 additions & 0 deletions eng/CodeAnalysis.test.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ dotnet_diagnostic.CA1863.severity = none
# CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
dotnet_diagnostic.CA1864.severity = none

# CA1868: Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = none

# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
foreach (var module in allModules)
{
if (!markedModules.Contains(module))
if (markedModules.Add(module))
{
markedModules.Add(module);
if (modulesWithCctor.Contains(module.Module))
sortedModules.Add(module.Module);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ void IDependencyAnalyzerLogNodeVisitor<DependencyContextType>.VisitCombinedNode(
void IDependencyAnalyzerLogEdgeVisitor<DependencyContextType>.VisitEdge(DependencyNodeCore<DependencyContextType> nodeDepender, DependencyNodeCore<DependencyContextType> nodeDependerOther, DependencyNodeCore<DependencyContextType> nodeDependedOn, string reason)
{
var combinedNode = new Tuple<DependencyNodeCore<DependencyContextType>, DependencyNodeCore<DependencyContextType>>(nodeDepender, nodeDependerOther);
if (!_combinedNodesEdgeVisited.Contains(combinedNode))
if (_combinedNodesEdgeVisited.Add(combinedNode))
{
_combinedNodesEdgeVisited.Add(combinedNode);

_xmlWrite.WriteStartElement("Link");
_xmlWrite.WriteAttributeString("Source", _nodeMappings[nodeDepender].ToString());
_xmlWrite.WriteAttributeString("Target", _nodeMappings[combinedNode].ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,7 @@ internal override bool TryGetExports(ImportDefinition definition, out Tuple<Comp
}
else
{
if (candidates.Contains(candidatePart))
{
alreadyProcessed = true;
}
else
{
candidates.Add(candidatePart);
}
alreadyProcessed |= !candidates.Add(candidatePart);
}
if (!alreadyProcessed)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,8 @@ private void IncrementRefCount(string clientId, EventCommandEventArgs command)
}
}

if (!_sharedSessionClientIds.Contains(clientId))
if (_sharedSessionClientIds.Add(clientId))
{
_sharedSessionClientIds.Add(clientId);
Interlocked.Increment(ref _sharedSessionRefCount);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/tasks/MobileBuildTasks/Android/AndroidProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ private static string BuildClangArgs(AndroidBuildOptions buildOptions)
string rootPath = Path.GetDirectoryName(lib)!;
string libName = Path.GetFileName(lib);

if (!libDirs.Contains(rootPath))
if (libDirs.Add(rootPath))
{
libDirs.Add(rootPath);
ret.Append($"-L {rootPath} ");
}
ret.Append($"-l:{libName} ");
Expand Down
3 changes: 1 addition & 2 deletions src/tools/illink/src/ILLink.Shared/Annotations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ private static DynamicallyAccessedMemberTypes[] GetAllDynamicallyAccessedMemberT
var values = new HashSet<DynamicallyAccessedMemberTypes> (
Enum.GetValues (typeof (DynamicallyAccessedMemberTypes))
.Cast<DynamicallyAccessedMemberTypes> ());
if (!values.Contains (DynamicallyAccessedMemberTypes.Interfaces))
values.Add (DynamicallyAccessedMemberTypes.Interfaces);
values.Add (DynamicallyAccessedMemberTypes.Interfaces);
return values.ToArray ();
}

Expand Down