[Mono-aspnet-list] Design problem in GTK#/ MessageDialog

Martin S. test051102 at hotmail.com
Mon Oct 8 14:37:41 UTC 2012

I have created a small program which runs under Windows and uses COM objects. The part the handels access to the COM object is inluded into a try/catch block. The catch block looks as follows:

catch(Exception ex)
     MessageDialog md=new MessageDialog(this,DialogFlags.Modal,MessageType.Error,ButtonsType.Ok,ex.Message);


If the COM object is not registered the first line within the catch blocks throws an exception. This second exception is not handled and the application crashes. It took me hours to find out the reason. The error message contains the COM object's class ID included unto braces {}. The contructor of MessageDialog assumes the message string (last parameter) is a format string which typically includes braces which function as a placeholder for parameters.. However, no parameters where specified. As a result, an exeption of type FormatException is thrown.

This kind of error is very difficult to track down. I think there should be a better way to design the MessageDialog class to prevent this problem.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20121008/45c32021/attachment.html>

More information about the Mono-aspnet-list mailing list