Thursday, 5 June 2008

Vista Problem - Debugging "[Application] has stopped working"

Well, it was bound to happen, and it finally has! I have found something I genuinely do not like in Vista.

While working on some code while studying Code Access Security (CAS). CAS basically allows you/your admin to control what resources .NET code has access to when running. This can be Dialog boxes, the Registry, Printing, Windows Services, Data Access, whatever, it seems pretty complete.

The idea behind the exercise that I was doing was to demo "Imperative" and "Declarative" CAS. "Imperative" checks the permissions before loading the assembly/code, "Declarative" checks the permissions at run-time. So, I create a simple application that will present a FileDialog box to the user prompting to select a file. Nothing flashy. The idea is that initially the application runs OK, I then configure the CLR to restrict access to FileDialog's for the application, then the application should throw an Exception saying "I can't do that".image

In XP, the code works exactly as expected, you get a nice dialog box with a big fat red "X" telling you there is a problem. However, in Vista, you do not. You get the ever-so-helpful "[Application] has stopped working" error message (shown to the right):

This is not good, because this means that if an exception occurs outside of my development machine, the user has no information to report back to me! Now, if I click the "Debug" button, it takes me to Visual Studio and gives me the full exception details that I need to know in order to fix it.image

I am unsure as to what happens if there is no debugger available on the machine, so I thought I would dig around in the "Problem Reports and Solutions" centre. So I located the crash reports and checked the details:

As you can see from the screen shot, not a lot of information is provided!

So I thought I would check out the settings for "Problem Reports and Solutions", and looking around, all I can see is how to disable the automatic submission, nothing suggesting a way of getting back to the old error dialog in XP. Is was ugly, but informative!image

Even disabling the feature all together just creates a simple dialog asking to close or debug!

Does anyone know if this is only occurring because I have Visual Studio installed? I cannot test what will happen without because I only have one Vista machine!

 

Share:  digg it! del.icio.us furl Live Technorati Facebook

No comments:

Post a Comment