DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   execution comes from catch to try (http://www.daniweb.com/forums/thread187602.html)

serkan sendur Apr 20th, 2009 2:53 pm
execution comes from catch to try
 
i have the following code :

static IScanningService scanningLayer = null;
                public static IScanningService BarcodeReader
                {
                        get
                        {
                                if (scanningLayer == null)
                                {
                                        string serviceName = GetServiceName();
                                        try
                                        {
                                                if (deviceService == null)
                                                        deviceService = Assembly.Load(serviceName);
                                                object o = deviceService.CreateInstance(serviceName + ".BarcodeReader");
                                                scanningLayer = o as IScanningService;
                                                scanningLayer.AutoStartScan = Global.device.AutoStartScan;
                                                scanningLayer.PauseTime = Global.device.PauseTime;
                                                scanningLayer.ScanTime = Global.device.ScanTime;
                                        }
                                        catch (Exception ex)
                                        {
                                                if (ex.InnerException == null)
                                                {
                                                        ErrorForm err = new ErrorForm();
                                                        err.ShowDialog();
                                                        //MessageBox.Show(ex.Message);
                                                       
                                                        //throw new ApplicationException(
                                                        //  string.Format(Properties.Resources.FailedToLoad, serviceName), ex);
                                                }
                                                //throw ex;
                                        }
                                }
                                return scanningLayer;
                        }
                }
for the first time in my life i see that after executing catch it comes back to try and starts infinite loop. Any explanation?

Ramy Mahrous Apr 20th, 2009 8:17 pm
Re: execution comes from catch to try
 
Strange!! Did you debug it?

serkan sendur Apr 21st, 2009 9:32 am
Re: execution comes from catch to try
 
Quote:

Originally Posted by Ramy Mahrous (Post 850675)
Strange!! Did you debug it?

yeah that was when i noticed the problem.


All times are GMT -4. The time now is 12:52 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC