cannot evaluated expression b/c gc is impossible

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John A Grandy

    cannot evaluated expression b/c gc is impossible

    I am trying to track down a mysterious null reference exception that occurs
    on making a call to a method in a assembly referenced by my project ( i.e.
    flow-of-control never arrives at the code inside the called method )

    try
    {
    // call to method in referenced assembly ( c# )
    }
    catch ( Exception ex )
    {
    throw ex;
    }

    However, I can not evaluate ex ... the reason given is :

    {Cannot evaluate expression because a thread is stopped at a point where
    garbage collection is impossible, possibly because the code is optimized.}

    How can I debug this ?


  • puzzlecracker

    #2
    Re: cannot evaluated expression b/c gc is impossible

    On Nov 3, 8:49 pm, "John A Grandy" <johnagrandy-at-gmail-dot-com>
    wrote:
    I am trying to track down a mysterious null reference exception that occurs
    on making a call to a method in a assembly referenced by my project ( i.e.
    flow-of-control never arrives at the code inside the called method )
    >
    try
    {
    // call to method in referenced assembly ( c# )}
    >
    catch ( Exception ex )
    {
    throw ex;
    >
    }
    >
    However, I can not evaluate ex ... the reason given is :
    >
    {Cannot evaluate expression because a thread is stopped at a point where
    garbage collection is impossible, possibly because the code is optimized.}
    >
    How can I debug this ?
    You can try rebuilding the code in debug mode. Also, try print the
    state of the method in the "finally" clause (or use a debug, setting a
    break prior to the error occurrence):

    try
    {
    // call to method in referenced assembly ( c# )}

    catch ( Exception ex )
    {
    throw ex;
    }finally
    {

    //This will execute before anything on the stack of this method
    will be GC'd
    }


    It's actually interesting about the GC's behavior in the presence of
    exception and the time local stack is clean-up...

    Comment

    Working...