我试图在运行时查看IAsyncStateMachine中发生了什么,我迫切需要查看它有哪些变量以及它调用的内容。我知道你可以看到ILSpy的代码......但是我需要调试它
有什么方法吗? 我需要看看IAsyncStateMachine MoveNext方法内部发生了什么!
public sealed partial class MethodBuilder<T> : Errand.MethodBuilder {
public static new MethodBuilder<T> Create() => new MethodBuilder<T>();
public new void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine {
this.myStateMachine = stateMachine;
this.Task = new Task<T>(this);
stateMachine.MoveNext(); //i have to see the properties of stateMachine and inside this method !!!!!
}
public new void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine machine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine {
}
public void SetResult(T result) {
this.Task.isCompleted = true;
this.Task.result = result;
}
public new void SetStateMachine(IAsyncStateMachine stateMachine) => base.SetStateMachine(stateMachine);
public new void SetException(Exception ex) => base.SetException(ex);
}
答案 0 :(得分:1)
来自MSDN How to: Debug .NET Framework Source。
启用.NET Framework源代码调试
在“工具”菜单上,单击“选项”。
在“选项”对话框中,单击“调试”类别。
在“常规”框中,设置“启用.NET Framework源步进”。
如果您启用了“我的代码”,则会出现一个警告对话框 Just My Code现已禁用。单击“确定”。
如果您没有设置符号缓存位置,则会发出另一个警告 对话框告诉您现在是默认符号缓存位置 组。单击“确定”。
在“调试”类别下,单击“符号”。
如果要更改符号缓存位置:
打开左侧框中的调试节点。
在“调试”节点下,单击“符号”。
将符号服务器中的缓存符号中的位置编辑为此 目录或单击“浏览”选择位置。
如果要立即下载符号,请单击“加载符号” 使用以上位置。
此按钮在设计模式下不可用。
如果您现在不选择下载符号,则符号将为 下次启动调试时自动下载 你的计划。
单击“确定”关闭“选项”对话框。
答案 1 :(得分:0)
也许你可以使用debugger.launch 一旦调试器启动,visual studio将提示vs版本选择
internal class Program
{
public static void Main(string[] args)
{
System.Diagnostics.Debugger.Launch();
Console.WriteLine("crap");
}
}