473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.NullReferenceException' 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_XML_SLAReport
'-----------------------------------------
' create an empty settings.xml file
Public Function Create_Empty_XML_SLAReport(ByVal sPath As String) As
Boolean
Dim sw As StreamWriter = New StreamWriter("SLAReport.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=""SLAReportSheetNumber"" type=""int""
description=""SHEET NUMBER in Excel Sheet collection where are stored
all data"">1</ParameterIN>")
sw.WriteLine("<ParameterIN id=""Period"" type=""string""
description=""Period on which report has been done"">A1</ParameterIN>")
sw.WriteLine("<ParameterIN id=""FirstDataRow"" type=""int""
description=""Number of first row which contains data for
reporting"">4</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CancelColumn"" type=""string""
description=""Letter of the column where is written CANCEL
flag"">A</ParameterIN>")
sw.WriteLine("<ParameterIN id=""TypeIssueColumn"" type=""string""
description=""Letter of the column which contains Request or
Order"">B</ParameterIN>")
sw.WriteLine("<ParameterIN id=""EvidenceDateColumn""
type=""string"" description=""Letter of the column where is written DATE
of EVIDENCE"">C</ParameterIN>")
sw.WriteLine("<ParameterIN id=""EvidenceNumberColumn""
type=""string"" description=""Letter of the column where is written
NUMBER of EVIDENCE"">D</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CustomerNameColumn""
type=""string"" description=""Letter of the column where is written
CUSTOMER NAME"">E</ParameterIN>")
sw.WriteLine("<ParameterIN id=""TaskDescriptionColumn""
type=""string"" description=""Letter of the column where is written TASK
DESCRIPTION"">F</ParameterIN>")
sw.WriteLine("<ParameterIN id=""DeadlineDateColumn""
type=""string"" description=""Letter of the column where is written
DEADLINE DATE when should be solved issue"">G</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SolvingDateColumn"" type=""string""
description=""Letter of the column where is written DATE when issue was
SOLVED"">H</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SolutionDescriptionColumn""
type=""string"" description=""Letter of the column where is written
SOLUTION DESCRIPTION"">I</ParameterIN>")
sw.WriteLine("<ParameterIN id=""ModuleColumn"" type=""string""
description=""Letter of the column where is written MODULE
name"">J</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SLANumberColumn"" type=""string""
description=""Letter of the column where is written SLA
CATEGORY"">K</ParameterIN>")
sw.WriteLine("<ParameterIN id=""DivisionColumn"" type=""string""
description=""Letter of the column where is written DIVISION
NAME"">L</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SupplierColumn"" type=""string""
description=""Letter of the column where is written SUPPLIER
NAME"">M</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CompanyColumn"" type=""string""
description=""Letter 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
Nov 21 '05 #1
1 1170
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" <no*****@nospam.com> wrote in message
news:ue****************@TK2MSFTNGP15.phx.gbl...
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.NullReferenceException' 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_XML_SLAReport
'-----------------------------------------
' create an empty settings.xml file
Public Function Create_Empty_XML_SLAReport(ByVal sPath As String) As
Boolean
Dim sw As StreamWriter = New StreamWriter("SLAReport.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=""SLAReportSheetNumber"" type=""int""
description=""SHEET NUMBER in Excel Sheet collection where are stored all
data"">1</ParameterIN>")
sw.WriteLine("<ParameterIN id=""Period"" type=""string""
description=""Period on which report has been done"">A1</ParameterIN>")
sw.WriteLine("<ParameterIN id=""FirstDataRow"" type=""int""
description=""Number of first row which contains data for
reporting"">4</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CancelColumn"" type=""string""
description=""Letter of the column where is written CANCEL
flag"">A</ParameterIN>")
sw.WriteLine("<ParameterIN id=""TypeIssueColumn"" type=""string""
description=""Letter of the column which contains Request or
Order"">B</ParameterIN>")
sw.WriteLine("<ParameterIN id=""EvidenceDateColumn"" type=""string""
description=""Letter of the column where is written DATE of
EVIDENCE"">C</ParameterIN>")
sw.WriteLine("<ParameterIN id=""EvidenceNumberColumn"" type=""string""
description=""Letter of the column where is written NUMBER of
EVIDENCE"">D</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CustomerNameColumn"" type=""string""
description=""Letter of the column where is written CUSTOMER
NAME"">E</ParameterIN>")
sw.WriteLine("<ParameterIN id=""TaskDescriptionColumn""
type=""string"" description=""Letter of the column where is written TASK
DESCRIPTION"">F</ParameterIN>")
sw.WriteLine("<ParameterIN id=""DeadlineDateColumn"" type=""string""
description=""Letter of the column where is written DEADLINE DATE when
should be solved issue"">G</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SolvingDateColumn"" type=""string""
description=""Letter of the column where is written DATE when issue was
SOLVED"">H</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SolutionDescriptionColumn""
type=""string"" description=""Letter of the column where is written
SOLUTION DESCRIPTION"">I</ParameterIN>")
sw.WriteLine("<ParameterIN id=""ModuleColumn"" type=""string""
description=""Letter of the column where is written MODULE
name"">J</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SLANumberColumn"" type=""string""
description=""Letter of the column where is written SLA
CATEGORY"">K</ParameterIN>")
sw.WriteLine("<ParameterIN id=""DivisionColumn"" type=""string""
description=""Letter of the column where is written DIVISION
NAME"">L</ParameterIN>")
sw.WriteLine("<ParameterIN id=""SupplierColumn"" type=""string""
description=""Letter of the column where is written SUPPLIER
NAME"">M</ParameterIN>")
sw.WriteLine("<ParameterIN id=""CompanyColumn"" type=""string""
description=""Letter 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

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
6
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
3
by: sara | last post by:
Very strange behavior, but I suspect some is A2K and some might be for me to correct. Just trying to see if anyone can help and advise. We have a database that's been running for a few years...
20
by: Pilcrow | last post by:
This behavior seems very strange to me, but I imagine that someone will be able to 'explain' it in terms of the famous C standard. -------------------- code -----------------------------------...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.