473,480 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

possible DataSet.ReadXml bug? or maybe just a user error ;)

Hopefully someone can point out what is going on here. I'll give a short
explanation first, then a more detailed one at the bottom if anyone wants to
dig into it more.

I have a strongly-typed dataset (from a .xsd file in my project) called
dsConfig.

When i make the following call:

dsConfig.ReadXml("buttons.xml", XmlReadMode.Auto);

i get the following error:

An unhandled exception of type 'System.NullReferenceException' occurred
in Unknown Module.
Additional information: Object reference not set to an instance of an
object.

HOWEVER.

If i change my call to this:

System.IO.FileStream fs = System.IO.File.OpenRead("buttons.xml");
dsConfig.ReadXml(fs, XmlReadMode.Auto);

then it executes properly.

Any ideas? Its not that complicated to do that, but it obviously shouldn't
be that way. More details at the bottom.

Thanks in advance!

Tim

-------------------------------------------------------

OK, so here are the details

I have a usercontrol (we'll call it A). inside of A, there is a function
(we'll call it DoStuff()) that executes the above line of code (the original
one that i said didn't work).
if i have an instance of A in a form, then A.DoStuff() executes with no
problems.

I then have an inherited usercontrol (we'll call it B) that inherits from A.
if i have an instance of B in a form, then B.DoStuff() executes with no
problems.

I then have a separate usercontrol (we'll call it C) that contains an
instance of B. In C, there is a function (we'll call it DoMoreStuff()) that
calls B.DoStuff(). If i have an instance of C on my form, and i call
C.DoMoreStuff(), then i get the error i listed above, and i can fix it only
with the above hack. The error actually occurs all the way down in the code
for A if i include all the projects. in the solution and step all the way
down into it.

Any ideas?

Tim

Nov 15 '05 #1
1 3328
I have an update to my problem.

I checked to see what XmlReadMode the call to ReadXml(fs, XmlReadMode.Auto)
was using (through the return value. It was using XmlReadMode.IgnoreSchema.

Now, if i use

dsConfig.ReadXml("buttons.xml", XmlReadMode.IgnoreSchema);

the line executes fine.

What gives? shouldn't Auto have been choosing this anyway? And even if it
wasn't, why wasn't this error occuring in the base class or the inherited
class, why just when i put the inherited class in a new control?

Thanks in advance,

Tim
Nov 15 '05 #2

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

Similar topics

5
385
by: DotNetJunkies User | last post by:
Hi all, I have a question on how can I write the entire Dataset to a NTEXT field of SQLServer. Can anyone help me? Thanks! /mike
1
5805
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point now sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
0
1464
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point not sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
22
25542
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
11
3916
by: MurdockSE | last post by:
Greetings. My Situation: // I have an .xml file that I am reading into a dataset in the following code - DataSet ds = new DataSet("MyDataset"); ds.ReadXml(@"c:\data\"+cmyxmlfilename);
6
1488
by: samoore33 | last post by:
I have created a xml doc that stores dates. On the first of the year I want to upload the xml doc into a dataset and then loop through it adding one year to those dates. This is what I have...
1
3613
by: Mac | last post by:
I'm trying to validate input from an xml source to a dataset in dotnet2.0. As far as I can see, type errors correctly cause an exception, but values that are the correct type but do not satisify...
1
4989
by: GoogleGroups | last post by:
It seems like this should be easy, but it has proven to be quite painful. I have an existing dataset, which I used the GetChanges and WriteXML functions upon to write out a DiffGram to a local...
4
1990
by: Thiago Macedo | last post by:
Hi, I posted an issue on the .vb group that is related to the .Net Framework 2.0. Posting here for a larger abrangence: i'm developing a windows application that gets data from an Mysql...
0
7048
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6911
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
7050
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,...
0
7091
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.