again strange behavior

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maileen

    #1

    again strange behavior

    Hi,

    I finished my application butonce again i have some strange behavior
    with XML/text functions...

    for example, here below is a function which worked perfectly till now
    and now generate an error :
    "An unhandled exception of type 'System.NullRef erenceException ' occured
    in Unknown Module.
    Addition information : object reference not set to an instance of object"
    when i click on break, i can not get anymore information, but if i click
    on continue, my application works perfectly... :-(

    this error is raised after few sw.WriteLine commands...
    i have the same issue if i do :

    dim doc as XMLDocument
    doc = new XMLDocument (here occured error)

    where could be the problem ?
    from my point of view, some options in application could have such
    impact but which ones ?

    '-----------------------------------------
    ' Create_Empty_XM L_SLAReport
    '-----------------------------------------
    ' create an empty settings.xml file
    Public Function Create_Empty_XM L_SLAReport(ByV al sPath As String) As
    Boolean
    Dim sw As StreamWriter = New StreamWriter("S LAReport.xml")
    ' Add basic skeleton of file
    sw.WriteLine("< ?xml version=""1.0"" ?>")
    sw.WriteLine("< SLAReport>")
    sw.WriteLine("< SourceFile>")
    sw.WriteLine("< Configuration>" )
    sw.WriteLine("< ParameterIN id=""SLAReportS heetNumber"" type=""int""
    description=""S HEET NUMBER in Excel Sheet collection where are stored
    all data"">1</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""Period"" type=""string""
    description=""P eriod on which report has been done"">A1</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""FirstDataR ow"" type=""int""
    description=""N umber of first row which contains data for
    reporting"">4</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""CancelColu mn"" type=""string""
    description=""L etter of the column where is written CANCEL
    flag"">A</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""TypeIssueC olumn"" type=""string""
    description=""L etter of the column which contains Request or
    Order"">B</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""EvidenceDa teColumn""
    type=""string"" description=""L etter of the column where is written DATE
    of EVIDENCE"">C</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""EvidenceNu mberColumn""
    type=""string"" description=""L etter of the column where is written
    NUMBER of EVIDENCE"">D</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""CustomerNa meColumn""
    type=""string"" description=""L etter of the column where is written
    CUSTOMER NAME"">E</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""TaskDescri ptionColumn""
    type=""string"" description=""L etter of the column where is written TASK
    DESCRIPTION"">F </ParameterIN>")
    sw.WriteLine("< ParameterIN id=""DeadlineDa teColumn""
    type=""string"" description=""L etter of the column where is written
    DEADLINE DATE when should be solved issue"">G</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""SolvingDat eColumn"" type=""string""
    description=""L etter of the column where is written DATE when issue was
    SOLVED"">H</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""SolutionDe scriptionColumn ""
    type=""string"" description=""L etter of the column where is written
    SOLUTION DESCRIPTION"">I </ParameterIN>")
    sw.WriteLine("< ParameterIN id=""ModuleColu mn"" type=""string""
    description=""L etter of the column where is written MODULE
    name"">J</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""SLANumberC olumn"" type=""string""
    description=""L etter of the column where is written SLA
    CATEGORY"">K</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""DivisionCo lumn"" type=""string""
    description=""L etter of the column where is written DIVISION
    NAME"">L</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""SupplierCo lumn"" type=""string""
    description=""L etter of the column where is written SUPPLIER
    NAME"">M</ParameterIN>")
    sw.WriteLine("< ParameterIN id=""CompanyCol umn"" type=""string""
    description=""L etter of the column where is written COMPANY
    NAME"">N</ParameterIN>")
    sw.WriteLine("</Configuration>" )
    sw.WriteLine("</SourceFile>")
    sw.WriteLine("< OutputFile>")
    sw.WriteLine("< ParameterOUT id=""test 3"">A 3rd test</ParameterOUT>")
    'sw.WriteLine(" </ParameterOUT>")
    sw.WriteLine("< TemplateFile>")
    sw.WriteLine("</TemplateFile>")
    sw.WriteLine("</OutputFile>")
    sw.WriteLine("</SLAReport>")
    sw.Close()
    End Function
  • Ken Tucker [MVP]

    #2
    Re: again strange behavior

    Hi,

    I dont know why you are getting the error at the new xmldocument
    line. I would use the xmltextwriter class to write the xml document instead
    of a streamwriter.

    http://msdn.microsoft.com/library/de...classtopic.asp

    Ken
    --------------------------
    "Maileen" <noemail@nospam .com> wrote in message
    news:ueN%23EpLo FHA.3608@TK2MSF TNGP15.phx.gbl. ..[color=blue]
    > Hi,
    >
    > I finished my application butonce again i have some strange behavior with
    > XML/text functions...
    >
    > for example, here below is a function which worked perfectly till now and
    > now generate an error :
    > "An unhandled exception of type 'System.NullRef erenceException ' occured in
    > Unknown Module.
    > Addition information : object reference not set to an instance of object"
    > when i click on break, i can not get anymore information, but if i click
    > on continue, my application works perfectly... :-(
    >
    > this error is raised after few sw.WriteLine commands...
    > i have the same issue if i do :
    >
    > dim doc as XMLDocument
    > doc = new XMLDocument (here occured error)
    >
    > where could be the problem ?
    > from my point of view, some options in application could have such impact
    > but which ones ?
    >
    > '-----------------------------------------
    > ' Create_Empty_XM L_SLAReport
    > '-----------------------------------------
    > ' create an empty settings.xml file
    > Public Function Create_Empty_XM L_SLAReport(ByV al sPath As String) As
    > Boolean
    > Dim sw As StreamWriter = New StreamWriter("S LAReport.xml")
    > ' Add basic skeleton of file
    > sw.WriteLine("< ?xml version=""1.0"" ?>")
    > sw.WriteLine("< SLAReport>")
    > sw.WriteLine("< SourceFile>")
    > sw.WriteLine("< Configuration>" )
    > sw.WriteLine("< ParameterIN id=""SLAReportS heetNumber"" type=""int""
    > description=""S HEET NUMBER in Excel Sheet collection where are stored all
    > data"">1</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""Period"" type=""string""
    > description=""P eriod on which report has been done"">A1</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""FirstDataR ow"" type=""int""
    > description=""N umber of first row which contains data for
    > reporting"">4</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""CancelColu mn"" type=""string""
    > description=""L etter of the column where is written CANCEL
    > flag"">A</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""TypeIssueC olumn"" type=""string""
    > description=""L etter of the column which contains Request or
    > Order"">B</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""EvidenceDa teColumn"" type=""string""
    > description=""L etter of the column where is written DATE of
    > EVIDENCE"">C</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""EvidenceNu mberColumn"" type=""string""
    > description=""L etter of the column where is written NUMBER of
    > EVIDENCE"">D</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""CustomerNa meColumn"" type=""string""
    > description=""L etter of the column where is written CUSTOMER
    > NAME"">E</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""TaskDescri ptionColumn""
    > type=""string"" description=""L etter of the column where is written TASK
    > DESCRIPTION"">F </ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""DeadlineDa teColumn"" type=""string""
    > description=""L etter of the column where is written DEADLINE DATE when
    > should be solved issue"">G</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""SolvingDat eColumn"" type=""string""
    > description=""L etter of the column where is written DATE when issue was
    > SOLVED"">H</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""SolutionDe scriptionColumn ""
    > type=""string"" description=""L etter of the column where is written
    > SOLUTION DESCRIPTION"">I </ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""ModuleColu mn"" type=""string""
    > description=""L etter of the column where is written MODULE
    > name"">J</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""SLANumberC olumn"" type=""string""
    > description=""L etter of the column where is written SLA
    > CATEGORY"">K</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""DivisionCo lumn"" type=""string""
    > description=""L etter of the column where is written DIVISION
    > NAME"">L</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""SupplierCo lumn"" type=""string""
    > description=""L etter of the column where is written SUPPLIER
    > NAME"">M</ParameterIN>")
    > sw.WriteLine("< ParameterIN id=""CompanyCol umn"" type=""string""
    > description=""L etter of the column where is written COMPANY
    > NAME"">N</ParameterIN>")
    > sw.WriteLine("</Configuration>" )
    > sw.WriteLine("</SourceFile>")
    > sw.WriteLine("< OutputFile>")
    > sw.WriteLine("< ParameterOUT id=""test 3"">A 3rd test</ParameterOUT>")
    > 'sw.WriteLine(" </ParameterOUT>")
    > sw.WriteLine("< TemplateFile>")
    > sw.WriteLine("</TemplateFile>")
    > sw.WriteLine("</OutputFile>")
    > sw.WriteLine("</SLAReport>")
    > sw.Close()
    > End Function[/color]


    Comment

    Working...