UndoNoThrow() private method

private UndoNoThrow ( ) : bool
return bool
        [HandleProcessCorruptedStateExceptions] //
#endif // FEATURE_CORRUPTING_EXCEPTIONS
        internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS)
        {
            CompressedStackSwitcher cssw = new CompressedStackSwitcher();

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                // Order is important in this block.
                // Also, we dont want any THreadAborts happening when we try to set it
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    // Empty try block to ensure no ThreadAborts in the finally block
                }
                finally
                {
                    // SetCompressedStackThread can throw - only if it suceeds we shd update the switcher and overrides
                    SetCompressedStackThread(cs);
                    cssw.prev_CS      = prevCS;
                    cssw.curr_CS      = cs;
                    cssw.prev_ADStack = SetAppDomainStack(cs);
                }
            }
            catch
            {
                cssw.UndoNoThrow();
                throw; // throw the original exception
            }
            return(cssw);
        }
Esempio n. 2
0
        internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS)
        {
            CompressedStackSwitcher compressedStackSwitcher = new CompressedStackSwitcher();

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                }
                finally
                {
                    CompressedStack.SetCompressedStackThread(cs);
                    compressedStackSwitcher.prev_CS      = prevCS;
                    compressedStackSwitcher.curr_CS      = cs;
                    compressedStackSwitcher.prev_ADStack = CompressedStack.SetAppDomainStack(cs);
                }
            }
            catch
            {
                compressedStackSwitcher.UndoNoThrow();
                throw;
            }
            return(compressedStackSwitcher);
        }
Esempio n. 3
0
        internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS)
        {
            CompressedStackSwitcher result = default(CompressedStackSwitcher);

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                }
                finally
                {
                    CompressedStack.SetCompressedStackThread(cs);
                    result.prev_CS      = prevCS;
                    result.curr_CS      = cs;
                    result.prev_ADStack = CompressedStack.SetAppDomainStack(cs);
                }
            }
            catch
            {
                result.UndoNoThrow();
                throw;
            }
            return(result);
        }
Esempio n. 4
0
        [HandleProcessCorruptedStateExceptions] // 
#endif // FEATURE_CORRUPTING_EXCEPTIONS
        internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS)
        {
            CompressedStackSwitcher cssw = new CompressedStackSwitcher();
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                // Order is important in this block.
                // Also, we dont want any THreadAborts happening when we try to set it
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    // Empty try block to ensure no ThreadAborts in the finally block
                }
                finally
                {
                    // SetCompressedStackThread can throw - only if it suceeds we shd update the switcher and overrides
                    SetCompressedStackThread(cs);
                    cssw.prev_CS = prevCS;
                    cssw.curr_CS = cs;
                    cssw.prev_ADStack = SetAppDomainStack(cs);                
                }
            }
            catch
            {
                cssw.UndoNoThrow();
                throw; // throw the original exception
            }
            return cssw;
        }
Esempio n. 5
0
 internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS)
 {
     CompressedStackSwitcher switcher = new CompressedStackSwitcher();
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         RuntimeHelpers.PrepareConstrainedRegions();
         try
         {
         }
         finally
         {
             SetCompressedStackThread(cs);
             switcher.prev_CS = prevCS;
             switcher.curr_CS = cs;
             switcher.prev_ADStack = SetAppDomainStack(cs);
         }
     }
     catch
     {
         switcher.UndoNoThrow();
         throw;
     }
     return switcher;
 }