views:

247

answers:

5

I have a project that when i compile it keeps crashing visual studio 2010. It's only that project in the solution, and it seems like it gets compiled, but it crashes.

It's a silverlight c# project

From the SDK command line tool I can run MSBuild, and the project will compile without problems, without crashing vs of course. When building in vs the project also gets compiled (I can see that it has been built when the vs restarts itself), it's just that vs crashes.

How can I debug this issue to resolve it?

---Tried:

  1. resetting the visual studio settings in: Tools -> Import and Export Settings -> reset all settings
  2. Writing out a log with devenv /log, but there are no errors and no warnings
  3. deleting the .suo file

Following Nescio's solution

I get this error just before visual studio crashes:

A StreamWriter was not closed and all buffered data within that StreamWriter was not flushed to the underlying stream. (This was detected when the StreamWriter was finalized with data in its buffer.) A portion of the data was lost. Consider one of calling Close(), Flush(), setting the StreamWriter's AutoFlush property to true, or allocating the StreamWriter with a "using" statement. Stream type: System.IO.FileStream File name: C:\Users\MyUser\AppData\Local\Temp\28e633d3642e4ac28a6ca861274e8b9a\svcutil.log Allocated from: callstack information is not captured by default for performance reasons. Please enable captureAllocatedCallStack config switch for streamWriterBufferedDataLost MDA (refer to MSDN MDA documentation for how to do this).

+1  A: 

I would try creating a new, empty project, and then add the source files from the original project one at a time until A) the project compiles successfully (which would indicate that there was some setting in the project with a problem), or B) you add a source module that causes the IDE to crash again (which would indicate that there's something in your code that the compiler can't deal with).

Either way, this probably signifies a bug in the IDE - even with invalid code, the IDE is not supposed to crash. I'm guessing that if you can narrow down the cause of the crash - especially if you can make it crash in a project with just one or two files in it - they're going to be happy to have you file a bug report.

jwismar
+2  A: 
  1. Open a new project in VS (C# or VB; something other than Silverlight/Web)

  2. Project Properties -> Debug -> Start External program: (Select your VS exe)

  3. Save

  4. Type: Ctrl+Alt+E

  5. when the Exceptions window pops up, check: [x] Thrown Common language runtime exceptions.

  6. Click Ok

  7. Run the project which will start a new instance of VS2010.

  8. Use this new instance to open the solution you wish to debug.

  9. Execute your solution... you should see the exception.

Nescio
Thank your for your suggestion - I can't find the start external program under my project poperties debug tab. Is there something obvious I'm not seeing? I forgot to mention that it's a silverlight project. I suppose that has something to do with it?
Jakob
@Nescio - just added yourname to draw your attention to the previous comment =)
Jakob
Updated my answer... sorry, I forgot Web Projects have different build properties.
Nescio
So what happens if an exception is not thrown??? I tried doing this, and I can see in the debug section that the output is written, but there is no stop at exception.the end of the output is:The program '[3460] devenv.exe: Managed (v4.0.30319)' has exited with code 9 (0x9).The program '[3460] devenv.exe: Program Trace' has exited with code 0 (0x0).
Jakob
@Nescio - forgot to add your name again =) thank you for the edit
Jakob
@Nescio - I flagged all the exception thrown chkboxes, and got a more specified error just before the crash as posted in the mainthread now.
Jakob
+1  A: 

In some cases like this, albeit with VS2005 and VS2008, I've had luck fixing the crash by closing Visual Studio, deleting the '.suo' user options file, and retrying.

Kevin Pullin
@Kevin Pullin - where is the .suo file located?
Jakob
@Jakob - It's located along side the solution file (.sln). This is a hidden file, so you might need to enable showing of all files.
Kevin Pullin
@Kevin Pullin - good suggestion, unfortunately it didn't help me
Jakob
A: 

This link describes the error message you are seeing...

Unfortunately, given the data you provided, I cannot determine what is causing the crash. Are you using any third party controls? Can you build any other Silverlight applications? Also, it may help if you provide the full exception, including the Stack Trace.

Nescio
+1  A: 

Try these steps:

  • Create new SL app from default template. If VS doesn't crash, then you will know that it is your project causing this. VS/.NET reinstall may help

  • Try installin VS Express. If this also crashes, then maybe VS/.NET files are corrupted.

  • Check EventViewer for errors

  • Try Debug VS with another VS

Tomas Voracek