views:

1066

answers:

6

when loading up a solution in VS2008 I get:

An error was encountered while opening associated documents the last time this solution was loaded. Document load is being skipped during this solution load in order to avoid that error.

How can I find which document is causing the problem?

+2  A: 

I can't say I've seen this particular error, but I'm wondering if that might be stored in the .suo file associated with your solution. The .suo is where VS tracks which files you had open previously, so maybe it tracks failed ones as well. You might try renaming or deleting that file and then reloading the solution to see if the error goes away. Unfortunately, those files aren't entirely human-readable, so if that proves to be the location, it may not be trivial to determine which file was at fault.

Pedro
deleting .suo solves the problem but what is the cause?
John Nolan
Sometimes, deleting the suo does not seem to fix the problem. It seems that opening ANY view page (aspx, haven't tested aspc) will cause VS to just shut down.
Charlie Flowers
@Charlie Flowers: The original post was in regards to a message about a previous load failure (which seemed to happen infrequently.) In your case, you are having problems opening any file without VS crashing. In that scenario, I would look for a custom control or invalid data binding that might be causing the crash.
Pedro
@Pedro - Thx for the response. It does not fail opening any files. Most files are fine. But ANY aspx or ascx file will cause it to crash. I'm using MVC, so I don't have any controls. What do you mean by an "invalid data binding"? And thanks for the help!
Charlie Flowers
@Charlie Flowers: I ran into an issue with WinForms pages that would crash VS if the data bindings were invalid. Not necessarily your problem but it was the first thing I thought of. My old blog post about it: http://automaticchainsaw.blogspot.com/2007/11/invalid-data-source-crashes-visual.html
Pedro
+1  A: 

I've been having that problem in VS2008 since I installed the Ajax Toolkit - no solution yet tho :(

Mordy
yeah i have the ajax toolkit installed too. interesting.
John Nolan
But I don't have ajax toolkit installed, and I still have the problem. I wonder if it might be Resharper related ... you guys have that?
Charlie Flowers
A: 

I had this issue as well. I deleted the *.sou file associated with the solution. When I attempted to load the solution again I was prompted with the same error except this time, Visual Studio didn't crash instantly. When I clicked "ok" on the error dialog the solution seemed to load just fine.

I have similar experiences. It seems to be random as to why the problem comes back to me.
John Nolan
A: 

I've been shut down by this problem all morning, so I've been doing some forced research. here's a tidbit that may help, along with some links I've found (but IO haven't read them all yet).

First of all, the tidbit. It seems that if I can get the solution to open at all (which I can, the second time, when VS.NET skips the "Document loading" step), and then immediately do a Rebuild All, that might "fix" the problem (meaning, the problem will go away for a while and show up a few days later, but at least I can get some work done).

Of course, that may turn out to be a red herring, but it appears to hold true right now.

Next, here are some links I've found. I haven't read all of them, but they are about this problem or very similar ones, and they may help somebody.

link text

link text

link text

link text

link text

link text

link text

link text

Charlie Flowers
A: 

I cleaned my solution via Build->Clean Solution.

Then I rebuilded my solution. Seems to work for me.

edit: i use VS 2010

Wesley
A: 

It may not be possible to definitely determine which file is causing the issue. Similar errors have been reported with widely varying circumstances, except for the condition where there is at least 1 file that was still open for editing at the last time the solution was successfully opened and closed.

I've looked at this myself with WinDbg active, and the call stack is filled with a chain of DLLs in thread/module unload state. Most likely this is being caused by a race condition or other faulty multi-threading behavior in visual studio.

Here are other references you can view, in case others update them with additional information.

IDE Reports Error ... @ Microsoft Connect
Error Loading Solution 100% of the time ... @ Microsoft Connect
Error opening associated documents ... @ Stack Overflow

Edit:

I should add that my conclusion of this being a race condition is based upon clues gathered while trying to create a minidump of the crash in Visual Studio with WinDbg; and prior history with similar unexplained bugs in older versions of Visual Studio.

In my exploration, WinDbg consistently reports that a minidump cannot be created for this crash because ReadProcessMemory has failed. The stack trace contains a trail of DllUnloads called for various reasons. There are no reports of this bug happening when there are no document views that were open at the last time the solution was closed. In combining these clues, my guess is that there are bugs in the order of instantiation; perhaps as two views of the same type are opened, one completes ahead of the other and causes the cleanup of a resource that is shared by both actions.

It is possible that this isn't a race condition or threading bug, though the symptoms strongly suggest it. Fortunately for myself and others who have chimed in with answers, when I've encountered this bug, deleting the .SUO file (and .NCB file in older versions of Visual Studio) fixes the problem.

meklarian