I want to make sure that my web application is performance wise and will not make any performance problems. When I searched, I found that one of the most common problems related to the performance issue is the "infinite loops" problem.
I want to ask:
Where should I begin to check that my code never causes infinite loops?
Are there any articles, advices, instructions, examples? I will be grateful.
ex:
May this code cause an infinite loop?
public static IEnumerable<SubjectNode> ReadSubjectNodes(string filePath)
{
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
using (XmlReader xrdr = new XmlTextReader(fs))
while (xrdr.Read())
if (xrdr.NodeType == XmlNodeType.Element && xrdr.LocalName == "subject")
yield return new SubjectNode(xrdr.GetAttribute("id"), xrdr.GetAttribute("name"), xrdr.GetAttribute("short"));
}
Thanks in advance