Intellitrace显示变量未知 - c#

时间:2017-07-04 15:38:06

标签: c# wpf intellitrace

所以我用一些基本代码测试了intellitrace,当我来查看itrace文件时,我可以看到异常而不是它周围的变量,它们都显示为未知。我不知道是不是我没有正确检查但是我不能让它们出现。

public partial class MainWindow : Window
{
    public List<User> items = new List<User>();

    public MainWindow()
    {
        InitializeComponent();
    }

    public void Button_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            click("sndafh");
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString() + " " + txtName.Text);
        }
    }
    public void click(string name)
    {
        items.Add(new User() { Name = txtName.Text, Age = txtAge.Text });
        string pName = name;


        Users.Items.Clear();
        Users.ItemsSource = items;
        Users.Items.Refresh();
    }
}


public class User
{
    public string Name { get; set; }

    public string Age { get; set; }
}

Snippet of VS 2015 with unknown variables

1 个答案:

答案 0 :(得分:0)

确保您已选择&#34; IntelliTrace events and call information&#34; Tools->Options->IntelliTrace->IntelliTrace Events下的选项。

有关详细信息,请参阅以下MSDN文章。

Visual Studio 2015 - 使用IntelliTrace更快地诊断问题: https://msdn.microsoft.com/en-us/magazine/dn973014.aspx