Dr TJ
Dr TJ

Reputation: 3354

Custom tool error Failed to generate code

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"

Upvotes: 1

Views: 11600

Answers (3)

Charles Iams
Charles Iams

Reputation: 1

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.

Upvotes: 0

fsbflavio
fsbflavio

Reputation: 874

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

Upvotes: 3

Dr TJ
Dr TJ

Reputation: 3354

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

Upvotes: 8

Related Questions