本文整理汇总了C#中CodeActivityContext.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# CodeActivityContext.Dispose方法的具体用法?C# CodeActivityContext.Dispose怎么用?C# CodeActivityContext.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeActivityContext
的用法示例。
在下文中一共展示了CodeActivityContext.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateExpression
internal object EvaluateExpression(string expressionString)
{
// This is to shortcircuit a common case where
// internally, vsdebugger calls our EE with literal "0"
int intResult;
if (int.TryParse(expressionString, out intResult))
{
return intResult;
}
// At refresh, Expression Evaluator may re-evaluate locals/arguments.
// To speed up the process, locals/arguments are cached.
LocalInfo cachedLocalInfo = null;
if (this.cachedLocalInfos != null && this.cachedLocalInfos.TryGetValue(expressionString, out cachedLocalInfo))
{
return cachedLocalInfo;
}
Activity activity = activityInstance.Activity;
LocationReferenceEnvironment locationReferenceEnvironment = activity.PublicEnvironment;
// a temporary context for EvaluateExpression
// We're not using the executor so it's ok that it's null
CodeActivityContext context = new CodeActivityContext(activityInstance, null);
object result;
try
{
// First try as R-Value
if (!TryEvaluateExpression(expressionString, null, locationReferenceEnvironment, context, out result))
{
return SR.DebugInfoCannotEvaluateExpression(expressionString);
}
}
catch (Exception ex)
{
// ---- all exceptions, this exception is generated by user typing input in either
// Watch window or Immediate windows. Exception should not affect the current runtime.
// Except for fatal exception.
if (Fx.IsFatal(ex))
{
throw;
}
context.Dispose();
return SR.DebugInfoCannotEvaluateExpression(expressionString);
}
// Now try expression as an L-Value if possible.
try
{
object resultLocation;
if (TryEvaluateExpression(expressionString, result.GetType(), locationReferenceEnvironment, context, out resultLocation))
{
LocalInfo localInfo = new LocalInfo()
{
Name = expressionString,
Location = resultLocation as Location
};
this.cachedLocalInfos[expressionString] = localInfo;
return localInfo;
}
}
catch (Exception ex)
{
// ---- all exceptions, this exception is generated by user typing input in either
// Watch window or Immediate windows. Exception should not affect the current runtime.
// Except for fatal exception.
if (Fx.IsFatal(ex))
{
throw;
}
}
finally
{
context.Dispose();
}
return result;
}