-
Notifications
You must be signed in to change notification settings - Fork 511
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
[registar] Search the entire interface hierarchy for protocols. Fixes #6493. #6514
Conversation
…amarin#6493. When we're searching for metadata for marshalling blocks, we must search the entire interface hierarchy for protocols that implement optional members. Fixes xamarin#6493.
Build failure |
public IEnumerable<ObjCType> AllProtocols { | ||
get { | ||
if (Protocols == null || Protocols.Length == 0) | ||
return null; |
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.
How important is the null return vs returning an emptyIEnumerable
?
It strikes me that you could also do:
bool protocolsRetrieved = false;
HashSet<ObjCType> all_protocols = new HashSet<ObjCType>();
public IEnumerable<ObjCType> AllProtocols {
if (protocolsRetrieved)
return all_protocols;
if (Protocols != null && Protocols.Length > 0) {
// code to fetch all the protocols here
}
protocolsRetrieved = true;
return all_protocols;
}
Then you don't need the null tests on this type ever.
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.
@stephen-hawley because an empty IEnumerable
uses more memory than null, and this is something that 99.9% of the time will be null (or empty).
@monojenkins backport d16-3 |
When we're searching for metadata for marshalling blocks, we must search the
entire interface hierarchy for protocols that implement optional members.
Fixes #6493.