Thursday, September 18, 2008

Linq2Sql Designer error: Unspecified Error on table rename

At work today, we hit an annoying little bug with the Linq2Sql DBML designer in VS 2008 SP1.

When trying to rename a table in the designer, the rename would fail with the message: Unspecified Error

I found this thread on the MSDN forums and tried moving all the includes inside of the namespace (what a strange bug/fix) but that did not work.

So here is our workaround:
  1. Open the DBML file in an editor, not the designer. (Right click on the .dbml file, select "open with" and choose the XML editor.)
  2. Find the table you want to change and change the name attribute of the type element.
  3. Save your change - Visual Studio will regenerate the designer code with the new name.

Hopefully, this will save you some time if you hit the same problem.