Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
We were developing a Server Object Model based functionality in SharePoint involving site creation using template. During development we use to get the following error in quick watch window.
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
To solve this issue we added the following code before the actual statement and issue was solved.
SPSecurity.CatchAccessDeniedException = false;