**The TLDR:**

I was editing a TableAdapter XSD file and it seemingly, suddenly, became malformed. Visual Studio now thinks that the file is an "XML To Schema", and the `designer.vb` file is gone. All references to the TableAdapter are, as assumed, throwing errors, and the TableAdapter itself is saying:

> 
> Custom tool error: Failed to generate code. Object reference not set to an instance of an object.
> 
> 
> 

**The elaborate version:**

I'm working on an older project in **Visual Studio 2013** at the moment that uses TableAdapters. I've been working on this project on-and-off for a year or so, and only came across this issue today:

I edited a query in the XSD file and saved, just as always. I then went to build the project, however I was surprisingly met with hundreds of errors. The first error points to my .XSD file:

> 
> Custom tool error: Failed to generate code. Failed to generate code. Object reference not set to an instance of an object. Object reference not set to an instance of an object. C:\Users\me\Documents\MyProject\Users.xsd 1 1 MyProject
> 
> 
> 

*(Yes, the error is returned exactly like that - duplicate phrasing and all.)*

The rest of the errors are all just references to the `Users` class.

It was then that I noticed the `Users.designer.vb` file had completely disappeared. While I'd assume this is the case only because it's auto-generated, in the past, the file has not completely disappeared in the event of an error.

Also, the icon next to the file has changed to the icon for an "XML To Schema" file:

[![enter image description here](https://i.stack.imgur.com/nFxj9s.png)](https://i.stack.imgur.com/nFxj9s.png)

...instead of the normal "DataSet" icon for a TableAdapter `.xsd` file, which indicates to me in some capacity that the file has been modified in such a way that Visual Studio is misinterpreting it.

Any help is appreciated, as my entire project is pretty much hanging in the balance at the moment.

**What I've tried:**

* Making changes to the .XSD file so that it could do a fresh rebuild of the designer, including a simple "undo" of the change I made when the whole thing fell apart
* Clean Solution, Clean Project, etc.
* Making a new TableAdapter DataSet, and copying the "corrupt" XSD to the newly created one in a text-editor
* Comparing to a previously-working version (from months ago, though I saw no notable differences aside from data structure modifications)
* Restoring old copy of the file (Restore points are disabled on this machine... doh.)