Problem with DataSet.WriteXml

J

Jim H

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
I

Ilya Tumanov [MS]

I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
J

Jim H

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


"Ilya Tumanov [MS]" said:
I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
I

Ilya Tumanov [MS]

Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


"Ilya Tumanov [MS]" said:
I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
J

John Tenney

Jim,

I don't believe that DataSet.WriteXml(string, XmlWriteMode) is not supported
in the compact framework, although DataSet.WriteXml(string) is. You might
try this if you want schema in your export file:

TextWriter exportStream = new StreamWriter(lDBFile, false);
lDataSet.WriteXML(new System.Xml.XmlTextWriter(exportStream),
XmlWriteMode.WriteSchema);

-John
 
J

Jim H

DataSet.WriteXml(string, XmlWriteMode) is not supported, but
DataSet.WriteXml(XmlWriter, XmlWriteMode) is supposed to be. That's the one
I'm using. In my code lDbFile is a System.Xml.XmlTextWriter and that's
still crashing.

jim
 
J

Jim H

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

"Ilya Tumanov [MS]" said:
Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


"Ilya Tumanov [MS]" said:
I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
I

Ilya Tumanov [MS]

Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

"Ilya Tumanov [MS]" said:
Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
R

Ravichandran J.V.

Why not simply supply a filename instead of a TextWriter object?

If you are getting this exception in ASP.Net, it may be due to
permissions as ASP.Net operates on a low privilige rights.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
J

Jim H

Simply supplying a filename string does not allow for saving of the schema
with the data. Only the XmlTextWriter does.

This is not in ASP.net. It's a plain old stand alone pocket app.

Thanks,
jim
Why not simply supply a filename instead of a TextWriter object?

If you are getting this exception in ASP.Net, it may be due to
permissions as ASP.Net operates on a low privilige rights.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
J

Jim H

I have done a hard reset, several actually. I've run the code on the
emulator and a Toshiba with PPC2002 with the same results. I cannot debug
through the physical device because this app communicates with another piece
of hardware through a serial connection. I can't hook up the serial
connection while the device is connected to the PC.

I can and do currently write another other text file from the same app. The
data in that text file comes from the table in the dataset.

Where do I get a stack trace from? I haven't seen it and the CF Exception
classes to not support Exception.Trace.

How do I install CF SP2 into the emulator? Like I said most of my debugging
needs to go through the emulator because that's the only device I have that
can be connected to VS and connect to a serial port at the same time. Is
there a CF SP2 that can be installed in VS so it automatically deploys SP2?

cgacutil from the PPC returns:
[1.0.2268.00] I believe that's .NETCF with no service packs.

Thanks,
jim

"Ilya Tumanov [MS]" said:
Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the
problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

"Ilya Tumanov [MS]" said:
Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line
throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
J

Jim H

Ok I downloaded and installed CF sp2 on both my physical device and the
emulator.
Same problem. When I run the app without the debugger and the unhandled
exception occurs I have the option for details which gives me this:

Application::Run+0xf
Form1::Main+0xc

Is that the stack trace you wanted? Doesn't look like much help.

Also It does write an xml file, just not all of it. Here's the end of the
file it creates:
<Results>
<sequence>19</sequence>
<time>632314491630000000</time>
<pid_name>RPM</pid_name>
<value>0</value>
<time_stamp>09/22/2004 11:26:03:000</time_stamp>
</Results>
<Results>
<sequence>18</sequence>
<time>632314491630000000</time>
<pid_name>Volts</pid_name>
<value>11.625</value>
<time_stamp>09/22/


Notice it does not finish writing the "time_stamp" value. This was line 656
in the file (the last line) It happens on smaller amounts of data as well.

In case you did not read my previous response....
I do write another text file in the app. That file is populated using data
from this table.
I also created an XmlTextWriter and wrote a test file using that. It had
just one element but worked fine. No errors.

I have done a hard reset, several actually. I've run the code on the
emulator and a Toshiba with PPC2002 with the same results. I cannot debug
through the physical device because this app communicates with another piece
of hardware through a serial connection. I can't hook up the serial
connection while the device is connected to the PC.

Thanks again,
jim

"Ilya Tumanov [MS]" said:
Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the
problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

"Ilya Tumanov [MS]" said:
Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line
throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
I

Ilya Tumanov [MS]

Could you please try this code? Thanks.

using System;
using System.IO;
using System.Data;
using System.Xml;

namespace Test
{

class test
{
static void Main(string[] args)
{
DataSet ds = new DataSet();
ds.Namespace = "NewNameSpace";
ds.WriteXml("foo.xml");
}
}
}

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
<[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Wed, 22 Sep 2004 11:37:21 -0400
Lines: 258
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61773
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Ok I downloaded and installed CF sp2 on both my physical device and the
emulator.
Same problem. When I run the app without the debugger and the unhandled
exception occurs I have the option for details which gives me this:

Application::Run+0xf
Form1::Main+0xc

Is that the stack trace you wanted? Doesn't look like much help.

Also It does write an xml file, just not all of it. Here's the end of the
file it creates:
<Results>
<sequence>19</sequence>
<time>632314491630000000</time>
<pid_name>RPM</pid_name>
<value>0</value>
<time_stamp>09/22/2004 11:26:03:000</time_stamp>
</Results>
<Results>
<sequence>18</sequence>
<time>632314491630000000</time>
<pid_name>Volts</pid_name>
<value>11.625</value>
<time_stamp>09/22/


Notice it does not finish writing the "time_stamp" value. This was line 656
in the file (the last line) It happens on smaller amounts of data as well.

In case you did not read my previous response....
I do write another text file in the app. That file is populated using data
from this table.
I also created an XmlTextWriter and wrote a test file using that. It had
just one element but worked fine. No errors.

I have done a hard reset, several actually. I've run the code on the
emulator and a Toshiba with PPC2002 with the same results. I cannot debug
through the physical device because this app communicates with another piece
of hardware through a serial connection. I can't hook up the serial
connection while the device is connected to the PC.

Thanks again,
jim

"Ilya Tumanov [MS]" said:
Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the
problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still
get
the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178 C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this: lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty != lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This line
throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
J

Jim H

That code ran without error.

I added code so it looked like this:

static void Main()
{
DataSet ds = new DataSet();
DataTable lTable = new DataTable("foobar");
lTable.Columns.Add(new DataColumn("column1", typeof(string)));
lTable.Columns.Add(new DataColumn("column2", typeof(long)));
for(int i = 0; i < 50; i++)
{
DataRow lRow = lTable.NewRow();
lRow["column1"] = "Test data:" + i.ToString();
lRow["column2"] = 10203040 + i;
lTable.Rows.Add(lRow);
}
ds.Tables.Add(lTable);
ds.Namespace = "NewNameSpace";
ds.WriteXml("foo.xml");
}

This code ran fine as well.

jim


"Ilya Tumanov [MS]" said:
Could you please try this code? Thanks.

using System;
using System.IO;
using System.Data;
using System.Xml;

namespace Test
{

class test
{
static void Main(string[] args)
{
DataSet ds = new DataSet();
ds.Namespace = "NewNameSpace";
ds.WriteXml("foo.xml");
}
}
}

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
<[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Wed, 22 Sep 2004 11:37:21 -0400
Lines: 258
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61773
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Ok I downloaded and installed CF sp2 on both my physical device and the
emulator.
Same problem. When I run the app without the debugger and the unhandled
exception occurs I have the option for details which gives me this:

Application::Run+0xf
Form1::Main+0xc

Is that the stack trace you wanted? Doesn't look like much help.

Also It does write an xml file, just not all of it. Here's the end of the
file it creates:
<Results>
<sequence>19</sequence>
<time>632314491630000000</time>
<pid_name>RPM</pid_name>
<value>0</value>
<time_stamp>09/22/2004 11:26:03:000</time_stamp>
</Results>
<Results>
<sequence>18</sequence>
<time>632314491630000000</time>
<pid_name>Volts</pid_name>
<value>11.625</value>
<time_stamp>09/22/


Notice it does not finish writing the "time_stamp" value. This was line 656
in the file (the last line) It happens on smaller amounts of data as well.

In case you did not read my previous response....
I do write another text file in the app. That file is populated using data
from this table.
I also created an XmlTextWriter and wrote a test file using that. It had
just one element but worked fine. No errors.

I have done a hard reset, several actually. I've run the code on the
emulator and a Toshiba with PPC2002 with the same results. I cannot
debug
through the physical device because this app communicates with another piece
of hardware through a serial connection. I can't hook up the serial
connection while the device is connected to the PC.

Thanks again,
jim

"Ilya Tumanov [MS]" said:
Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the
problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall
CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get
the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178
C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of
this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same
line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178
C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this:
lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for
another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net
24.233.164.226
Path:


cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any
ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty !=
lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This
line
throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
J

Jim H

Got it!!! I figured it out. It was a bug in my code. I new it was I just
couldn't figure out what. I put a lock on the table and the errors went
away. It looks like the thread queue on the ppc must get backed up writing
to the results table. There is a thread reading from a serial port and it
puts data packets on the thread queue using ThreadPool.QueueUserWorkItem.
When I trigger the system to stop logging and to dump the table to an xml
file the thread pool must have a sizable list still in the queue and must
still be inserting records while the data was being written out. I guess
this never bit me before on the desktop version because of the speed
differences between the processors and the io. Just a guess. I'll put the
same fix into the desktop version though.

jim

Thanks again for all your help and time. Sorry I wasted so much of it.
"Ilya Tumanov [MS]" said:
Could you please try this code? Thanks.

using System;
using System.IO;
using System.Data;
using System.Xml;

namespace Test
{

class test
{
static void Main(string[] args)
{
DataSet ds = new DataSet();
ds.Namespace = "NewNameSpace";
ds.WriteXml("foo.xml");
}
}
}

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
<[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Wed, 22 Sep 2004 11:37:21 -0400
Lines: 258
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:61773
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Ok I downloaded and installed CF sp2 on both my physical device and the
emulator.
Same problem. When I run the app without the debugger and the unhandled
exception occurs I have the option for details which gives me this:

Application::Run+0xf
Form1::Main+0xc

Is that the stack trace you wanted? Doesn't look like much help.

Also It does write an xml file, just not all of it. Here's the end of the
file it creates:
<Results>
<sequence>19</sequence>
<time>632314491630000000</time>
<pid_name>RPM</pid_name>
<value>0</value>
<time_stamp>09/22/2004 11:26:03:000</time_stamp>
</Results>
<Results>
<sequence>18</sequence>
<time>632314491630000000</time>
<pid_name>Volts</pid_name>
<value>11.625</value>
<time_stamp>09/22/


Notice it does not finish writing the "time_stamp" value. This was line 656
in the file (the last line) It happens on smaller amounts of data as well.

In case you did not read my previous response....
I do write another text file in the app. That file is populated using data
from this table.
I also created an XmlTextWriter and wrote a test file using that. It had
just one element but worked fine. No errors.

I have done a hard reset, several actually. I've run the code on the
emulator and a Toshiba with PPC2002 with the same results. I cannot
debug
through the physical device because this app communicates with another piece
of hardware through a serial connection. I can't hook up the serial
connection while the device is connected to the PC.

Thanks again,
jim

"Ilya Tumanov [MS]" said:
Unfortunately, stack trace from the debugger is not very helpful.
It just shows us your app and we already know which line caused the
problem.

Here are my suggestions:

1. Hard reset the device (which one is it, by the way?) and reinstall
CF
(if possible).
2. Make sure you have CF SP2 installed on the device.
3. Remove exception handling and allow exception to be unhandled. Run app
without debugger. In that case you'll get a stack trace inside CF libs.
4. Try writing some text to the file using System.IO.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 22:25:13 -0400
Lines: 157
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61699
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Tried using System.Xml.XmlTextWriter("\\test.xml", null ); and still get
the
same exception.

Here's the stack
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 284 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178
C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

The SaveTableToXmlFile method contains the code from the beginning of
this
message.

Using DataSet.WriteXml(\\test.xml) throws an IOException on the same
line.
The file was created but is 0 length.

Here's the stack:
CELogger.dll!AvtInterface.DataLogFile.SaveTableToXmlFile() Line 285 C#
CELogger.dll!AvtInterface.DataLogFile.WriteResultsToFile() Line 180 C#
CELogger.dll!AvtInterface.DataLogFile.set_LogToFile(bool value = false)
Line 65 + 0x6 bytes C#
CELogger.dll!AvtInterface.RapidPacketLogger.StopLogging() Line 178
C#
PocketLogger.exe!PocketLogger.Form1.OnStopClick(System.Object sender =
{Text="Stop"}, System.EventArgs e = {System.EventArgs}) Line 217 C#

There has to be a way to do this.

jim

Let's try it without encoding:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml", null );

Or, (not exactly the same) how about this:
lDataSet.WriteXml("\\foo.xml");

Also, do you have the stack trace for this exception?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 17:00:00 -0400
Lines: 84
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61684
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Nope, still the same error.

Also, that same filename selection portion of the code works for
another
text file it creates, so I don't think it has anything to do with the
filename. But, I did try it like you had it to make sure.

Any other ideas?

jim


I would suspect bad file name is entered. Please try this:

lDbFile = new System.Xml.XmlTextWriter("\\test.xml",
System.Text.Encoding.ASCII);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Jim H" <[email protected]>
Subject: Problem with DataSet.WriteXml
Date: Tue, 21 Sep 2004 09:21:37 -0400
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net
24.233.164.226
Path:


cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:61646
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I am getting the following error from a call to DataSet.WriteXml():

'System.InvalidOperationException' occurred in mscorlib.dll

The code works fine on the desktop version of the program. Any
ideas
what
I'm doing wrong?

Thanks in advance,
jim

Here's the code:

string lsFileName = string.Empty;
DialogResult lResult;
lResult = lFileDialog.ShowDialog();
if(DialogResult.OK == lResult && string.Empty !=
lFileDialog.FileName)
{
lsFileName = lFileDialog.FileName;
if(Path.GetExtension(lsFileName) != ".xml")
lsFileName += ".xml";
lDbFile = new System.Xml.XmlTextWriter(lsFileName,
System.Text.Encoding.ASCII);
lDbFile.Formatting = System.Xml.Formatting.Indented;
lbReturnCode = true;
}
DataSet lDataSet = new DataSet("DataResults");
lDataSet.Tables.Add(m_ResultsTable);
lDataSet.WriteXml(lDbFile, XmlWriteMode.WriteSchema); //This
line
throws
exception
lDbFile.Close();
//lDbFile = null;
lDataSet.Tables.Remove(m_ResultsTable);
lDataSet = null;
 
Top