The possible solution is to inclide in nterface method an [out] parameter of
custom type. This type should be serializabe, of course.
Im also get this problem now. I have an application, logic is implmented as
regular assembly, but now it must be placed into COM+. So, now I have to add
the parameter to all the methods and then rewrite ALL the client code! But I
don't want this silly work! Does anyone know some other solution?!
[quoted text, click to view] "John Leyva" <jleiva@orbitel.com.co> wrote in message
news:300192FF-D3B1-4155-AE61-F15DE1AA3813@microsoft.com...
> This is the enviroment
>
> A WinForm application call a ServicedComponent, it is activated in Server
Mode.
> This ServicedComponent, throw a CustomException that is catched by de
WinForm Application.
>
> When the ServicedCompoent does not implement another Interface, the
exception catched by
> the application is CustomException, like I expected.
> However when the ServicedCompoent does implement another Interfacem the
exception catched by
> the application is ApplicationException.
>
> thanks for any help.
>
> CODE
>
> -- Custom Exception, Defined in another class library, ----
>
> [Serializable]
> public class CustomException : ApplicationException
> {
>
> protected CustomException(SerializationInfo info,
> StreamingContext context) : base(info, context) {}
>
> public CustomException() : base() {}
>
> public CustomException(string message) : base(message) {}
>
> public CustomException(string message,Exception inner) :
> base(message, inner) {}
> }
>
>
> -- Class Library with ServicedComponent, Activation Mode :
> Server---------------------------------
>
> public interface IThrowExcepcion: IDisposable
> {
> void ThrowCustomException(string Mensaje);
> }
>
> // In this way, works. But, if i implement
> IThrowExcepcion, it does not work
> public class ThrowExcepcion:
> ServicedComponent //,IThrowExcepcion
>
> {
> public ThrowExcepcion() {}
>
> public void ThrowCustomException(string Mensaje)
> {
> throw new ION.Servicios.Excepciones.CustomExcepcion
> (Mensaje);
> }
> }
>
>
> --- To show the case i useo the next code
>
> try
> {
> using (Test.ThrowExcepcion Tester = new
> (Test.ThrowExcepcion())
> {
> Tester.ThrowCustomException ("Prueba1");
> }
> }
> catch (CustomExcepcion E)
> {
> // if i do not implement IThrowExcepcion, it execute
> this code
> MessageBox.Show ("with IThrowExcepcion");
> }
> catch (ApplicationException E)
> {
> // if i implement IThrowExcepcion, it execute this code
> MessageBox.Show ("without IThrowExcepcion");
> }
>