Greetings again.

I'm encountering an error with the following section of my script.
If I include the commented section my program returns the following error;

"(Router -Startup) the URL cannot be empty. Parameter name : url"

With it commented out like below, the .dll functions correctly.

public List<Form> Startup()
        {
            //{
            //    string fileName = _songName;
            //    XPathDocument doc = new XPathDocument(_songName);
            //    XPathNavigator nav = doc.CreateNavigator();
            //    // Compile a standard XPath expression
            //    XPathExpression expr;
            //    expr = nav.Compile("/musicfile");
            //    XPathNodeIterator iterator = nav.Select(expr);
            //    try
            //    {
            //        while (iterator.MoveNext())
            //        {
            //            XPathNavigator nav2 = iterator.Current.Clone();
            //            MessageBox.Show("Title: (" + nav2.Value); 
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message);
            //    }
            //}
            this.m_targets.Clear();
            foreach (XmlNode node in this.m_setupNode.SelectNodes("Program_Files"))
            {
                byte num = (byte)Math.Round((double)((Convert.ToSingle(node.Attributes["color"].Value) * 255f) / 100f), MidpointRounding.AwayFromZero);
                if (File.Exists(node.InnerText))
                {
                    this.m_targets[num] = new string[] { node.InnerText, node.Attributes["other"].Value };
                }
            }
            return this.m_dialogList;
        }

I can also reverse the commented /uncommented sections keeping the

}
   return this.m_dialogList;
 }

in either section and the uncommented section will also function.

They just do not like to work together.

I can only assume I have a malformed section.


any suggestions?

Too a while but I found the error.

I was missing

this.fileName = executableObject.FileName;

in my initialize section.

which meant my

XPathDocument doc = new XPathDocument(_songName);

had a null for _songName

its now working and I can move on to my next step.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.