2009-03-04

Error connecting to undo manager of source file "whatever control/page.designer.cs"

I've run into this problem a couple of times where I get an error that states:
Error connecting to undo manager of source file "MyControl.ascx.designer.cs" (I've seen it with an aspx.designer.cs too.)

I don't know what the cause is, but I have a sneaking suspicion that the culprit in both of my cases was merge operations from source control interactions where, for whatever reason, my designer became out-of-sync or something with its ascx/aspx counterpart.

After searching around the net, it seemed the most popular method of correcting the problem was to delete the designer completely, then run the option to convert the project to a Web Application.

That option didn't sit right with me. I searched on.

I found an article by Scott Hanselman that discussed excluding the designer from the project, recompile, re-include, recompile again. That seemed a much more fitting solution to me; but I wondered if it could be even easier. So I tried an experiment.

My experiment consisted of simply opening the designer.cs file, typing a character somewhere in the file, deleting the new character, saving the file and recompiling.

The problem disappeared for me after that. (I will note that I cleaned the solution and rebuilt it prior to trying this, and that may be a required piece of the solution to the problem, but I would try the simple step first, then add in the clean/rebuild after.)

I'm using Visual Studio 2008 SP1. I hope this helps someone else out there.