Search code examples
c#wpfintellitrace

Intellitrace display's unknown for variables - c#


So I'm testing out intellitrace with some basic code and when I come to view the itrace file I can see the exception but not the variables around it, they all show as unknown. I don't know if it's something I haven't checked correctly but I can't get them to appear.

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


Solution

  • Make sure that you have selected the "IntelliTrace events and call information" option under Tools->Options->IntelliTrace->IntelliTrace Events.

    Please refer to the following MSDN article for more information.

    Visual Studio 2015 - Use IntelliTrace to Diagnose Issues Faster: https://msdn.microsoft.com/en-us/magazine/dn973014.aspx