Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public bool Equals(ServiceIdentifier other)
{
if (ServiceKey == null && other.ServiceKey == null)
{
return ServiceType.Equals(other.ServiceType);
return ServiceType == other.ServiceType;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

operator== is overloaded for System.Type and it just forwards the call to Equals unless the type is RuntimeType: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Type.cs#L654-L666

Is it actually fixing anything?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As long as you are trying to compare RuntimeType against DecoratedType at least.

The comment

// If `left` is a non-runtime type with a weird Equals implementation
// this is where operator `==` would differ from `Equals` call.

seems to indicate that someone else already experienced that...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a test for this?

}
else if (ServiceKey != null && other.ServiceKey != null)
{
return ServiceType.Equals(other.ServiceType) && ServiceKey.Equals(other.ServiceKey);
return ServiceType == other.ServiceType && ServiceKey.Equals(other.ServiceKey);
}
return false;
}
Expand Down