SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Justin Dearing

  • Improved unhandled exception reporting in SharpDevelop3

    One of the areas the SharpDevelop debugger has been weak in is dealing with unhandled exceptions. Ths has been improved in SharpDevelop 3 in two areas. These are the Local Variable pad, and the form that displays unhandled exceptions thrown from a debugged application to the user.

    To illustrate these changes I have made a simple C# solution that contain a simple program that throws an exception when run. You can download it via the svn url I suggest familarizing yourself with the new features by running this solution inside of SharpDevelop 3. You can of course write your own simple application that throws an exception.

    In the past, when an uncaught exception is thrown by an application being debugged by SharpDevelop, a simple form with a text are is displayed. The textarea contained information about the exception including the message and stacktrace. You then had the option to break, ignore or terminate. If you selected break, the debugger would pause at the point the exception was thrown. If the local stack frame happened to have an exception object referencing the exception being thrown, you could explore the exception. However, this was not always the case. Therefore one had to stick a redundant "catch (Exception ex) { throw; }" in their code to explore an exception. This is no longer the case thanks to several improvements in the debugger.

    The first thing you will notice is that the TextArea in the unhandled exception form displays more data and displays the exceptions InnerException property recursively.  The second thing you will notice is that you can now maxamize the form. Wha tis not immediatly apparent is that when you resize this form, its size and position is stored in your SharpDevelop settings. Therefore, next time you get an unhandled exception, the form will be the same size.

    Finally, you will notice a hyperlink labeled "Show Exception Details". When you click on that a TreeViewAdv widget displays the exception details exactly as it would be displayed in the local variable pad. This gives you access to all the exception properties.

    If you select "Break" on the debugger window, and look at the local variable pad, you will notice that in addition to all the other variables, one called $exception exists. This is the exception that was thrown at this point in the application. This is illustrated below.

    LocalVarPad Unhandled Exception

    To illustrate the differences between the unhandled exception dialog in the SharpDevelop 2 and SharpDevelop 3 debuggers, below is a screenshow of them both displaying an unhandled exception.

    Debugger Exception Dialogs

    I hope this small improvement will make debugging an application with SharpDevelop easier.

  • Opening Relevant Folders in Explorer

    These are a few small features the should help with common workflow senarios. The idea of an IDE is that one should not have to directly invoke the compilers or operating system services like a file manager. However, sometimes you just need to browse your source folders in internet explorer. Hence, I have added three new context menu items that launch new explorer windows.

    Two of the new items are the same context menu item in different locations. If you right click on a source file in the project panel or a tab in the text editor, you get an option labeled "Open Containint Folder in Explorer." Like the name suggests, selecting this menu item opens a new explorer window with the folder containing that source file. You can then manipulate these files from explorer as you see appropiate.

     Open Containing Folder (Project Panel)  Open Containing Folder (Text Exditor)

    IconBarMargin.cs Explorer Folder

    The other feature is for projects. If you right click on a project in the project panel you get a menu item labeled "Open Output Folder". This will open the folder where the projects compiled assemblies get placed. In most cases this is "bin\Release" or "bin\Debug" depending on the projects active build configuration.

    Open Output Folder (Project Panel).png  SD3 Destination Folder

     These features are simple, and by no means make SharpDevelop a "must have" IDE for anyone. However, it is overall attention to little details like this that make a good program a great program.

  • Support for Readonly Solutions and Projects

    One of the smaller new "features" of SharpDevelop 3 is improved readonly project and solution support. However small this feature is, it's quite useful.

    Why readonly project support?

    The first question is why? Many developers might be asking themselves when they would ever encounter a project or solution file with the readonly attribute set. Well the most common scenario, or at least the scenario where I encounter this is when the project is controlled by Visual Source Safe.

    Visual SourceSafe, and version control software modeled after it, is designed around a model of one person checks out a file at a time and has exclusive access to it until they check it in. There is support for multiple checkouts, and merging, but these features are frowned upon by many SourceSafe users. To enforce this behavior on the client end, files in your sandbox that are not checked out are marked readonly. Visual Studio handles checking out files and marking them read-write when you attempt to edit them.

    Ok, but if you use Visual SourceSafe, you probably also use Visual Studio!

    This is probably true in the general case, and true in my specific case. My employer has us use Visual SourceSafe and Visual Studio. For the most part I use these tools to develop code for my employer. I'm not going to use another source control repository. Using a central repository is more important than than using one with a checkin/checkout model I agree with. However, sometimes I want to use a feature of SharpDevelop not available in Visual Studio. Or maybe I already have 2-3 copies of Visual Studio open and need to have a few more solutions open to browse through. SharpDevelop has a much smaller memory footprint than Visual Studio.

    Ok so what does it look like already?

    Well here is an example screenshot of readonly and non readonly projects in a readonly solution. Basically all that changed since SharpDevelop 2 is the IDE doesn't try to save the *proj file or sln file. It also won't let you do anything to modify the file. Finally, as illustrated, it lets you know the file is readonly in the project panel.

     SharpDevelop Readonly Project screenshots.

    Posted Aug 22 2008, 09:16 AM by zippy1981 with no comments
    Filed under:
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.