MSDataSetGenerator failed

Working with TableAdapter and MSDataSetGenerator and having recurring problems with an error:

"The custom tool 'MSDataSetGenerator' failed. Failed to generate code. Object reference not set to an instance of an object."

This error is intermittent and occurs when adding an Insert query. Sometimes, especially after rebooting, I can create the query and it all works. I can then go back to add another query and I get the error. The designer.vb file is deleted as it tries to regenerate.

If I comment out the <DbSource> ... </DbSource> XML in the xsd file for the queries and 'Run Custom Tool', the designer.vb file is regenerated fine. Activate the commented out query again and I get the error again.

If I have successfully created a query - all working fine - and go back to add another query, once the error occurs I have to comment out both queries to get it to regenerate.

The queries are renamed to Query and Query1.

Any ideas? Is there a better forum for this question?

Thanks, John

[1225 byte] By [johnvarney] at [2007-12-24]
# 1
I have the same problem. How can this be prevented? I've lost allot of time over this.
polymorphicx at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2
I used the brute-force method and just deleted all of the generated files below the XSD. I ran the tool and everything seems to work.
betpagal at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 3

That's not pretty but I guess we have to do what we have to do!

Thanks!

polymorphicx at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 4
Copy of my post to another forum, no solutions:

I have been struggling with Dataset Designer for weeks off and on but it came to a head yesterday when it refused to work. Adding a query other than a select caused an error where MSDatasetGenerator failed with an "Object reference not set to an instance of an object" error.

Tried innumerable things. Nothing worked. Reinstalled VS 2005 and tested with a new Windows Forms app, NewWFApp. It worked. Joy!

Went to my WPF app. Didn't work ?

Tried the NewWFApp. Didn't work ?

Restarted VS. Tried NewWFApp. Worked

Tried new WPF app, NewWPFApp. Didn't work.

Seems that WPF interferes with the Dataset designer in some way.

Quick test. Add a dataset to a project, Dataset1. Create the Datatable and TableAdapter. You should see a Dataset1.Designer.vb file (Show all files).

Add a query, just a Delete query deleting everything. Right click on Dataset1.xsd and click Run Custom Tool. The Dataset1.Designer.vb file disappears and there is an error.

16 Nov 2006

Some additional info.

I am working with Net Framework 3.0, WPF in particular. If I try working with dataset designer in VS that has been used for a WPF project, I get all the issues. If I close it down and restart but use a Windows Forms project, it seems to work OK.

So I have created a Windows Forms project called DatasetDesign and use that to work on the datasets library. When I save the work, the changes are automatically loaded into the library that is also open in the WPF project. Can't work on the library in the WPF project though!

John

johnvarney at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 5

This same thing happened to me. Use stored procedures when writing queries instead of just generating sql statements for tableAdapters

in the dataset designer. The error will dissappear.

BlueDymond at 2007-8-31 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...