Пример #1
0
        public static Exception AssertAndFailFast(string description)
        {
            Fx.Assert(description);
            string failFastMessage = InternalSR.FailFastMessage(description);

            // The catch is here to force the finally to run, as finallys don't run until the stack walk gets to a catch.
            // The catch makes sure that the finally will run before the stack-walk leaves the frame, but the code inside is impossible to reach.
            try
            {
                try
                {
                    Fx.Exception.TraceFailFast(failFastMessage);
                }
                finally
                {
                    Environment.FailFast(failFastMessage);
                }
            }
            catch
            {
                throw;
            }

            return(null); // we'll never get here since we've just fail-fasted
        }
Пример #2
0
        public static Exception AssertAndFailFast(string description)
        {
            string str = InternalSR.FailFastMessage(description);

            try
            {
                try
                {
                    Fx.Exception.TraceFailFast(str);
                }
                finally
                {
                    Environment.FailFast(str);
                }
            }
            catch
            {
                throw;
            }
            return(null);
        }