1

Why this error is appearing? I was just setting some default values in a dataset designer... its second time that this is appearing...
"Custom tool error Failed to generate code. Exception of type 'System.OutOfMemoryException' was thrown"

Dr TJ
  • 3,241
  • 2
  • 35
  • 51

3 Answers3

8

I just found a way to regenerate codes.
In Solution Explorer right click on your DataSet and click Run Custom Tool.
I do it after closing and reopening VS2010...
Hope this help you, if you faced the problem...
good luck

Dr TJ
  • 3,241
  • 2
  • 35
  • 51
1

This happened to me when I changed the target framework from .net 4.5 to .net 4.8 on Visual Studio 2019.

For me was the Connections tag was looking for a global connection string or DatabaseProvinder that no longer existed.

If you don't need the connection anymore, You can just get rid of it.

Do that:

1- Right-click on the .xsd file chose open with and chose 'XML (Text) Editor', or another text editor that you prefer. 

2- Delete de content of the Connections tag and closes it.

After that, you will have something like this:

...
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
    <Connections />
    <Tables />
    <Sources />
  </DataSource>
...

Reference / Similar question

fsbflavio
  • 664
  • 10
  • 22
0

I've found this to be dependent on the particular version of .NET. In my case, I could never get it to generate using 4.8–but it works perfectly with 4.8.1. Given that, try to upgrade your version of .NET.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • @MoritzRingler: Good catch. Thank you for keeping me honest. I’ve made minor edits to the answer to avoid any confusion. – Jeremy Caney May 09 '23 at 00:50