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?

Strange!! Did you debug it?

Strange!! Did you debug it?

yeah that was when i noticed the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.