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);

     md.Run();
     md.Destroy();
 }

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.


                                          
_______________________________________________
Mono-aspnet-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Reply via email to