Esempio n. 1
0
        public void ExceptionsThrownInTheConstructorFailGracefully()
        {
            BrokenObject broken = null;

            try
            {
                broken = new BrokenObject();
            }
            catch (Exception)
            {
            }
            finally
            {
                broken?.Dispose();
                broken = null;
            }

            // trigger the finalizer
            CollectGarbage();
        }
Esempio n. 2
0
        public void ExceptionsThrownInTheConstructorFailGracefully()
        {
            BrokenObject broken = null;

            try
            {
                broken = new BrokenObject();
            }
            catch (Exception)
            {
            }
            finally
            {
                broken?.Dispose();
                broken = null;
            }

            // try and trigger the finalizer
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }