Exemplo n.º 1
0
        /// <exception cref="GetValueException">Can not evaluate in optimized code</exception>
        static Eval CreateEval(Process process, string description, EvalStarter evalStarter)
        {
            ICorDebugEval corEval = CreateCorEval(process);

            Eval newEval = new Eval(process, description, corEval);

            try {
                evalStarter(newEval);
            } catch (COMException e) {
                if ((uint)e.ErrorCode == 0x80131C26)
                {
                    throw new GetValueException("Can not evaluate in optimized code");
                }
                else if ((uint)e.ErrorCode == 0x80131C28)
                {
                    throw new GetValueException("Object is in wrong AppDomain");
                }
                else if ((uint)e.ErrorCode == 0x8013130A)
                {
                    // Happens on getting of Sytem.Threading.Thread.ManagedThreadId; See SD2-1116
                    throw new GetValueException("Function does not have IL code");
                }
                else if ((uint)e.ErrorCode == 0x80131C23)
                {
                    // The operation failed because it is a GC unsafe point. (Exception from HRESULT: 0x80131C23)
                    // This can probably happen when we break and the thread is in native code
                    throw new GetValueException("Thread is in GC unsafe point");
                }
                else if ((uint)e.ErrorCode == 0x80131C22)
                {
                    // The operation is illegal because of a stack overflow.
                    throw new GetValueException("Can not evaluate after stack overflow");
                }
                else if ((uint)e.ErrorCode == 0x80131313)
                {
                    // Func eval cannot work. Bad starting point.
                    // Reproduction circumstancess are unknown
                    throw new GetValueException("Func eval cannot work. Bad starting point.");
                }
                else
                {
                                        #if DEBUG
                    throw;                             // Expose for more diagnostics
                                        #else
                    throw new GetValueException(e.Message);
                                        #endif
                }
            }

            process.NotifyEvaluationStarted(newEval);
            process.AsyncContinue(DebuggeeStateAction.Keep);

            return(newEval);
        }
Exemplo n.º 2
0
	    /// <exception cref="GetValueException">Can not evaluate in optimized code</exception>
	    static Eval CreateEval(Process process, string description, EvalStarter evalStarter)
		{
			ICorDebugEval corEval = CreateCorEval(process);
			
			Eval newEval = new Eval(process, description, corEval);
			
			try {
				evalStarter(newEval);
			} catch (COMException e) {
				if ((uint)e.ErrorCode == 0x80131C26) {
					throw new GetValueException("Can not evaluate in optimized code");
				} else if ((uint)e.ErrorCode == 0x80131C28) {
					throw new GetValueException("Object is in wrong AppDomain");
				} else if ((uint)e.ErrorCode == 0x8013130A) {
					// Happens on getting of Sytem.Threading.Thread.ManagedThreadId; See SD2-1116
					throw new GetValueException("Function does not have IL code");
				} else if ((uint)e.ErrorCode == 0x80131C23) {
					// The operation failed because it is a GC unsafe point. (Exception from HRESULT: 0x80131C23)
					// This can probably happen when we break and the thread is in native code
					throw new GetValueException("Thread is in GC unsafe point");
				} else if ((uint)e.ErrorCode == 0x80131C22) {
					// The operation is illegal because of a stack overflow.
					throw new GetValueException("Can not evaluate after stack overflow");
				} else if ((uint)e.ErrorCode == 0x80131313) {
					// Func eval cannot work. Bad starting point.
					// Reproduction circumstancess are unknown
					throw new GetValueException("Func eval cannot work. Bad starting point.");
				} else {
					#if DEBUG
						throw; // Expose for more diagnostics
					#else
						throw new GetValueException(e.Message);
					#endif
				}
			}
			
			process.NotifyEvaluationStarted(newEval);
			process.AsyncContinue(DebuggeeStateAction.Keep);
			
			return newEval;
		}