c# - Linq XML Dynamic building -


I am creating an XML file Part of the file is static. Some files are dynamic. There is an error of "zero object reference" in my code

Any suggestions will be awesome.

  Private XElement BuildDataElement () {// This is going to be a more complex new XElement ("data"); } Public Zero TestXML (String Fname) {// Create Data Element XElement allData = BuildDataElement (); // Header XDocument Document = New XDocument (New XElement ("New Map", New XAttribute ("ShowBel", "1"), New XAttribute ("includeNameInLabels", "1"), New XElement ("Color Range", New XElement ("Color", New XAttribute ("minValue", "1"), All Data, New XElement ("Application", New XElement ("Apply", New XAttribute ("toObject", "TOOLTIP"), New XAttribute ("Style", "ttipfonts, myatteletlet style"))); If File.Exists (fname) File.Delete (fname); doc.Save (fname);}  
< / Div>

Any tips will be great.

You found my tip here

  • Obtain a debugger.
  • Set up debugger to break all exceptions
  • Unwilling to run your code in the debugger The context is an exception.
  • Understand which value was meaningless, which you were not expecting to be empty.
  • Enter a check for either tap that Handles the situation where the value is not correct, or the argument changes so that it is zero for that value. Impossible to be
  • Well-code-reviewed and tested.
  • Write a regression test for your test suite which this bug confirms is that 't come back.

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -