none
"Function evaluation disabled because a previous function evaluation timed out..."

    Question

  • I am creating a Package and I get this error when I try to see the locals.

    "Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation."

    The code where it happens is attached herewith:

    private SpeechRecognizer recogniser =  new SpeechRecognizer();
            private DTE2 theApplication = null;
            private Solution2 theSolution;

            public MouthCodeSpeechRecogniser(DTE2 application)
            {
                if (null != application)
                {
                    theApplication = application; //ERROR OCCURS HERE AND ALL SUBSEQUENT CODE BELOW(NOT SHOWN)
                    recogniser.Enabled = true;
    ......
    This code is called from MenuItemCallback of the package.
                     EnvDTE80.DTE2 dte2;
                    dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.9.0");
                    MouthCodeSpeechRecogniser mcsrRec0 = new MouthCodeSpeechRecogniser(dte2);

    Please help, a prompt response will be greatly appreciated.

            
    Friday, May 01, 2009 5:20 PM

Answers

  • Hello Roahn,
    Thank you for your reply. Luckily for me, the issue was solved when I changed the code, and used DTE object instead of DTE2. I guess I need the VSX guys to tell me why it got corrected.
    I had read the links you sent. but there are two major problems:

    1) [System.Diagnostics.DebuggerBrowsable (DebuggerBrowsableState .Never)] I could not apply to DTE since it disabled the bebugging for me.

    2)
    Unchecking "Enable property evaluation and other implicit function calls" was doing the same for me, I couldn't achieve anything from the debugger as I am building a package and the "time-out" was occuring at the initializig when I obtained the DTE object. All subsequent properties in objects, etc could not be seen in quickview and immediate windows.

    Anyways thanks for your response. I will appreciate if you could guide me how to a link to avoid this issue again in multithreading apps.
    Tuesday, May 05, 2009 3:08 AM

All replies

  • Hello Omar,

    I'm sorry for the delay response.

    Function Evaluation or Property Evaluation is the ability to inject some arbitrary call while the debuggee is stopped at some place. For the CLR, Function Evaluation means hijacking the thread the debugger choosen and using this purticular thread to execute the requested method. It usually happens when an expression specifies  a procedure call but another evaluation has time out in Visual Studio Debugger.

    I have a few suggestions:
     1. Click Tools | Options.. | Debugging | General, and uncheck "Enable property evaluation and other implicit function calls" option.
     2. Step into (F11) the code to find the root cause of the "time out"
     3. Restart debugging

    For more information on the Function Evaluation error, please refer to: http://msdn.microsoft.com/en-us/library/ms234762(VS.80).aspx
    Also, we could get more workarounds of Function Evaluation at blog: http://blogs.msdn.com/greggm/archive/2005/11/18/494648.aspx

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Edited by Roahn Luo Tuesday, May 05, 2009 2:35 AM more information.
    Tuesday, May 05, 2009 2:34 AM
  • Hello Roahn,
    Thank you for your reply. Luckily for me, the issue was solved when I changed the code, and used DTE object instead of DTE2. I guess I need the VSX guys to tell me why it got corrected.
    I had read the links you sent. but there are two major problems:

    1) [System.Diagnostics.DebuggerBrowsable (DebuggerBrowsableState .Never)] I could not apply to DTE since it disabled the bebugging for me.

    2)
    Unchecking "Enable property evaluation and other implicit function calls" was doing the same for me, I couldn't achieve anything from the debugger as I am building a package and the "time-out" was occuring at the initializig when I obtained the DTE object. All subsequent properties in objects, etc could not be seen in quickview and immediate windows.

    Anyways thanks for your response. I will appreciate if you could guide me how to a link to avoid this issue again in multithreading apps.
    Tuesday, May 05, 2009 3:08 AM
  • Hi Omar,

    I'm glad to hear that the issue has been solved properly.

    DebuggerAttributes are usually used on members of classes, such as properties, indexers, and fileds. If we apply these DebuggerAttributes to a class or interface, the compiler will not work. We could get samples from: http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerdisplayattribute.aspx

    Function Evaluation occurs on single thread. The debugger picks up the thread which is currently active. We might get deadlocks in multithreading apps. The reasons could be found by clicking: http://blogs.msdn.com/jmstall/archive/2005/11/15/funceval-rules.aspx

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Friday, May 08, 2009 7:48 AM