-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable IDE0059 analyzer: Unnecessary assignment of a value #63340
Conversation
Tagging subscribers to this area: @dotnet/area-meta Issue Detailsnull
|
...n/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
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
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
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
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
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
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILOptimizerVisitor.cs
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
@@ -281,7 +281,7 @@ private static void CheckReceivedBy(string receivedBy) | |||
|
|||
// '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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -9,15 +9,6 @@ namespace System.Net.NetworkInformation | |||
{ | |||
public partial class NetworkChange | |||
{ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was but I changed csproj file not to pull these private fields at all
Failures are unrelated due to |
No description provided.