Enable IDE0059 analyzer: Unnecessary assignment of a value#63340
Enable IDE0059 analyzer: Unnecessary assignment of a value#63340marek-safar merged 8 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-meta Issue Detailsnull
|
...n/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
Outdated
Show resolved
Hide resolved
...Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
Outdated
Show resolved
Hide resolved
...ate.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
Outdated
Show resolved
Hide resolved
src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
Outdated
Show resolved
Hide resolved
...Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
Outdated
Show resolved
Hide resolved
...Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/DataRelationCollection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/ForeignKeyConstraint.cs
Outdated
Show resolved
Hide resolved
...em.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/Headers/EntityTagHeaderValue.cs
Outdated
Show resolved
Hide resolved
...Private.DataContractSerialization/src/System/Runtime/Serialization/CollectionDataContract.cs
Outdated
Show resolved
Hide resolved
...stem.Private.DataContractSerialization/src/System/Runtime/Serialization/HybridObjectCache.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBaseWriter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILOptimizerVisitor.cs
Outdated
Show resolved
Hide resolved
671f1dc to
e994c23
Compare
...Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionFactory.cs
Outdated
Show resolved
Hide resolved
...em.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs
Outdated
Show resolved
Hide resolved
| // 'receivedBy' can either be a host or a token. Since a token is a valid host, we only verify if the value | ||
| // is a valid host.; | ||
| if (HttpRuleParser.GetHostLength(receivedBy, 0, true, out string? host) != receivedBy.Length) | ||
| if (HttpRuleParser.GetHostLength(receivedBy, 0, true, out _) != receivedBy.Length) |
There was a problem hiding this comment.
@geoffkizer, not sure how much it actually matters, but looking at the call sites to GetHostLength, it seems several of them end up ignoring the out string host even though the method will end up allocating one, regardless. Might be worth a look, and if there are other similar cases that could be improved.
There was a problem hiding this comment.
Yeah, this is ugly. The usual pattern of the GetXLength methods here and elsewhere is that they return an int to indicate the length, but don't actually construct the substring, which the caller can do trivially. Not sure why this one is different. I'll take a look.
| { | ||
| static NetworkChange() | ||
| { | ||
| // fake usage of static readonly fields to avoid getting CA1823 warning when we are compiling this partial. |
There was a problem hiding this comment.
It was but I changed csproj file not to pull these private fields at all
|
Failures are unrelated due to |
No description provided.