|
Hi I'm working with Visual Studio 2008 SP1 on a Vista Ultimate x64 machine. Whenever I'm working on a WPF project and something goes wrong (i.e. some line of code should throw a possibly unmanaged exception), the debugging session fails tonotice the exception and I get a system message saying that the application crashed. I can'e even make use oftry/catch statements. This makes debugging very hard... Any ideas, anyone? Thanks, Federico | | fededevita Thursday, October 01, 2009 10:32 AM | Interesting, first, what Exception type do you catch in the try...catch clause? You should at least catch NullReferenceException or its base type. Second, what do you mean by "vshost.exe stops working", do you have any symptom? You may try to turn-off the VS hosting process to see if the problem exists. Go to project property->Debug->"Enable the Visual Studio hosting process". Uncheck it.
Jeffrey Tan - MSFT- Marked As Answer byRoahn LuoMSFT, ModeratorThursday, October 08, 2009 2:40 AM
-
| | Jeffrey Tan - MSFT Saturday, October 03, 2009 1:19 AM | Hello Federico, Please go to Debug -> Exceptions, and check the Thrown checkbox on the unmanaged exceptions, for example, C++ Exception, Native Run-Time Checks. This will enable the debugger to break at the line where the unmanaged exception occurs. Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework! | | Roahn Luo Friday, October 02, 2009 3:18 AM | Hi Roahn
Thanks for your idea but it doesn't work. More specifically, I am trying to access a property of an object that I have not assigned a value to. Instead of getting a null reference exception, I get the system window saying that vshost has stopped working. The line of code looks like this:
MyClass myObject = new MyClass(myOtherObject.Name);
where my class is defined as
public class MyClass
{
public MyClass(string name)
{
Name = name;
}
public Name { get; set;}
}
I get to the line defining myObject without having defined myOtherObject as an instance of whatever class. If I put a breakpoint on the line, I can see that myOtherObject is still null. At this point, I should get an exception. The line is inside a try/catch statement, so I expect it to be caught by my code, but it isn't and the vshost.exe stops working.
Federico
| | fededevita Friday, October 02, 2009 2:02 PM | Interesting, first, what Exception type do you catch in the try...catch clause? You should at least catch NullReferenceException or its base type. Second, what do you mean by "vshost.exe stops working", do you have any symptom? You may try to turn-off the VS hosting process to see if the problem exists. Go to project property->Debug->"Enable the Visual Studio hosting process". Uncheck it.
Jeffrey Tan - MSFT- Marked As Answer byRoahn LuoMSFT, ModeratorThursday, October 08, 2009 2:40 AM
-
| | Jeffrey Tan - MSFT Saturday, October 03, 2009 1:19 AM |
Hi Roahn
Thanks for your idea but it doesn't work. More specifically, I am trying to access a property of an object that I have not assigned a value to. Instead of getting a null reference exception, I get the system window saying that vshost has stopped working. The line of code looks like this:
MyClass myObject = new MyClass(myOtherObject.Name);
public class MyClass
{
public MyClass(string name)
{
Name = name;
}
public Name { get; set;}
}
I get to the line defining myObject without having defined myOtherObject as an instance of whatever class. If I put a breakpoint on the line, I can see that myOtherObject is still null. At this point, I should get an exception. The line is inside a try/catch statement, so I expect it to be caught by my code, but it isn't and the vshost.exe stops working.
Federico
Hello Federico, I doubt the code snippet could be compiled correctly ( at least it failed on my machine). If the souce code could not be compiled correctly, we could not launch the debugger by pressing F5. I agree with Jeffrey, to narrow down the issue, we could disable the Visual Studio host process. By the way, could we generate a simple test project for the issue? For example, a console project? We'd be very appreciated if there are code snippet to reproduce the issue. Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework! | | Roahn Luo Tuesday, October 06, 2009 9:40 AM |
|