|
Posted by Oliver on June 11, 2008, 7:16 pm
Please log in for more thread options > Two biggy problems with this code. =A0One, you should never catch an excep=
tion
> if you do nothing with it. =A0Either get rid of your catch, or use it (log=
, or
> pop up a message box). =A0Two, don't destroy your session. =A0By doing thi=
s you
> are probably hurting rms. =A0Unless you explicitly created the session obj=
ect
> (which you did not, RMS passed it to you), you should not destroy it. =A0J=
ust
> my $.02.
>
> --
> Thank you,
> Ryan Sakry
> Program Manager
> Retail Information Technology Enterprises
> 320-230-2288
sage
>
>
>
>
> >I have a program that gets executed in POS. Occasionally POS closes
> > that program in the midle of execution; after trying to restart it the
> > error message shows "Attempt to process COM object 'ObjectName'
> > failed. An unknown error occurred." I am invoking this program from
> > Custom POS Button. Here is entry code. The exception below is never
> > executed.
>
> > namespace FrameWiz
> > {
> > =A0 =A0[ComVisible(true)]
> > =A0 =A0public class Startup
> > =A0 =A0{
> > =A0 =A0 =A0 =A0public bool Process(object argSession)
> > =A0 =A0 =A0 =A0{
> > FrameWizShell frameWizShell =3D null;
> > Session mySession =3D null;
>
> > try
> > {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//mine code here
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return true;
> > }
> > catch(Exception)
> > {
> > =A0 =A0 throw;
> > }
> > finally
> > {
> > =A0 =A0 frameWizShell.Dispose();
> > =A0 =A0 mySession.Destroy();
> > }
> > =A0 =A0 =A0 =A0}
> > =A0 =A0}
> > }- Hide quoted text -
>
> - Show quoted text -
Thank you for your response. I am aware of problems described. I just
added try, catch, finally statement recently after getting this error
for a while and I added code to destroy Session just before posting
this message. I have been getting this error for a while now on number
of computers and was not able to fix it. I cannot debug this neither
because the error occurs on some of the clients computers. I was not
able to replicate it on my computer so far. Bottom line without try,
catch, finally, disposing, or destroying any object the POS
occasionally closes down my program.
Regards
|