Menu

#49 ExternalXmlSummaryCache.GetSummary breaks with null types

open
nobody
Core (23)
9
2011-04-03
2011-04-03
Anonymous
No

ExternalXmlSummaryCache.GetSummary breaks with null types. This comes from invalid <see cref=""> tags I think, where it can't find the type.
Here's the fix (added a null check):

public string GetSummary(string memberID, Type declaringType) {
//extract member type (T:, P:, etc.)
string memberType = memberID.Substring(0, 2);

//extract member name
int i = memberID.IndexOf('(');
string memberName = i > -1 ? memberID.Substring(memberID.LastIndexOf('.', i) + 1)
memberID.Substring(memberID.LastIndexOf('.') + 1);

//the member id in the declaring assembly
string summary = "";
if (declaringType != null && declaringType.FullName != null)
{
string key = memberType + declaringType.FullName.Replace("+", ".") + "." + memberName;

//check the summaries cache first
summary = (string)summaries[key];

if (summary == null)
{
//lookup the xml document
GetXmlFor(declaringType);

//the summary should now be cached (if it exists!)
//so lets have another go at getting it...
summary = (string)summaries[key];

//if no summary was not found, create an blank one
if (summary == null)
{
//Debug.WriteLine("#NoSummary#\t" + key);
summary = "";
//cache the blank so we don't search for it again
summaries.Add(key, summary);
}

}
}
return "<summary>" + summary + "</summary>";
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB