9
Vote

bug in exception management

description

A new bug was introduced in ManagePartition.exe version 3.0.

The bug is located in the Run() method exceptionn handler at line number 235
            }
            catch (Exception e)
            {
                sc.Disconnect();
                sc = null;
                Console.WriteLine(e);
            }
            sc.Disconnect(); 
            sc = null;
when an exception occurs, the exception handler sets sc = null
then the sc.Disconnect(); following the catch block fails with an "Object reference not set to an instance of an object", that is caught in the Main() exception handler level, instead of the real exception.

in version 2.0 a there was a throw at the end of the catch block.
            catch (Exception ex)
            {
                sc.Disconnect();
                sc = null; 
                throw ex;
            }
            sc.Disconnect();
            sc = null;

comments