Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

AddIn modifies solution -> Visual Studio crashes when closing

$
0
0

I have written an AddIn, in c#, that modifies a C++ solution (or a solution that contains C++ projects), and updates it - it adds / removes project dependencies (http://msdn.microsoft.com/en-us/library/envdte.builddependency.addproject(v=vs.100).aspx). 

It works.

After it does its job though, sometimes (not always), Visual Studio crashes.

Details:

I can save the updated solution. I can build it. Visual Studio will (may) crash when I try to close it.

I have added 

try { solution.SaveAs(solution.FullName); // no exception } catch (System.Exception e) { MessageBox.Show(e.Message); } try { solution.Close(false); // exception } catch (System.Exception e) { MessageBox.Show(e.Message); }


If I close without ever trying to save, VS will (probably) not crash.

If I Close with (true) or close with (false) after saving (as above), I get 

"System.AccessViolationException: Attempted to read or 
write protected memory. This is often an indication 
that other memory is corrupt."


The crash is very bad after this exception.

There is nothing in my code that would justify this - and after all, Visual Studio would warn me if the BuildDependency failed, or if the solution was in any way defective - It actually would not build !

My thoughts are going towards something from the solution not being cleaned up, but there are no methods that I can use, prior to Close() - to clean up...

I actually would not like to close my solution, would prefer to leave it to the user, I just want it not to crash.

Note: I am unable to "Debug" - I have set up this class inside a "Perform()", I assume that may be the reason, but I have been unable to use breakpoints at all throughout my troubleshooting.





Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>