Tuesday, March 13, 2012

Strange Problem

foreach(XmlNode xn in N)
{
config.AddModule(TabID, Convert.ToInt32(xn.Attributes["ModuleOrder"].Value),xn.Attributes["PaneName"].Value, xn.Attributes["ModuleTitle"].Value, Convert.ToInt32(xn.Attributes["ModuleDefId"].Value), Convert.ToInt32(xn.Attributes["CacheTimeout"].Value), xn.Attributes["EditRoles"].Value);
}

Sometimes this function executes well and stores all the values in the xmlfiles. But sometimes, it writes only half the value and disconnects. What to do?

Raja PandianCould you elaborate a little bit on your application?
I am calling a fuction inside a for loop. The function somewhat a big one which stores data to XML file. Sometimes, the function executes correct and gives me the desiered output. But manytimes I can see only half of the function executed.

Any help plz

Raja Pandian
What happens when the function doesn't execute properly? Does it throw an exception, or does it just silently miss out a whole lot of data? I see you're making some assumptions about the structure of the XML file you're reading -- e.g. ModuleOrder, ModuleDefID and CacheTimeout are integers -- if this isn't the case you may be getting NullReferenceExceptions or FormatExceptions.

If it's just silently discarding data the problem is more likely to be in your config.AddModule() method -- try stepping through it in the debugger to see what's going on.

0 comments:

Post a Comment