我的调试输出在哪里?

时间:2015-10-02 14:19:03

标签: c# wpf visual-studio methods

我正在关注一个没有源代码的多个站点教程,所以我写了

.growme {
    background-color: #990000;
    height: 0;
    width: 0;
    position: absolute;
    filter: alpha(opacity=0);
    opacity: 0;
    top:0;
    left:0;
    bottom:0;
    right:0;
    margin:auto;

}

查看输出和调试/输出,我什么也看不见? 这是我第一次真正在C#工作,所以它更像是一个视觉工作室问题,还是一个为什么consoleWL也是空白的问题?

我的输出是

class Methods
{
    public void MethodDemo()
    {
        WriteAsBytes(32);
    }

    public void WriteAsBytes(int p)
    {
        byte[] bytes = BitConverter.GetBytes(p);
        foreach (byte b in bytes)
        {
            string message = String.Format("0x{0} ", b);
            Debug.Write(message);
            Console.Write("{0:X}", 0xffff);

            Console.WriteLine("Hey look here " + message);
        }
        Debug.WriteLine(" space ");
        Console.WriteLine(" ");
    }
}

我不知道在WPF应用程序中找到控制台的位置。

2 个答案:

答案 0 :(得分:1)

可能有两种情况会阻止任何信息写入输出窗口:

  • Solution Configuration设置为Release,然后标有[Conditional("DEBUG")]属性的所有内容都不会被编译到最终的可执行文件中。检查配置是否设置为Debug

enter image description here

    未检查Program output中的
  • Output window。检查是否已选中Program output

enter image description here

答案 1 :(得分:0)

如果您将代码作为WPF应用程序的一部分运行,那就是您没有看到来自' Console.Write`的输出。

要查看控制台输出,您可以从WPF应用程序手动创建控制台窗口,但正如您刚刚说明的那样,您可能不希望这样做。更简单的选择是从Visual Studio中的新项目开始,然后选择structure(list(ID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), divisions = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L), divs_20 = c(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), mean20 = structure(c(3L, 3L, 6L, 9L, 5L, 2L, 4L, 1L, 7L, 8L, 11L, 12L, 12L, 10L, 13L, 15L, 14L, 16L, 17L, 17L, 27L, 26L, 24L, 21L, 19L, 21L, 22L, 23L, 20L, 21L, 18L, 20L, 21L, 25L, 28L, 28L, 29L, 30L, 32L, 31L, 46L, 45L, 47L, 45L, 43L, 44L, 43L, 43L, 42L, 41L, 37L, 38L, 40L, 36L, 35L, 33L, 34L, 35L, 36L, 39L, 48L, 51L, 35L, 50L, 50L, 34L, 49L, 33L, 35L, 53L, 52L, 54L, 50L, 33L, 53L, 36L, 36L, 53L, 52L, 52L, 63L, 62L, 63L, 64L, 65L, 65L, 61L, 60L, 60L, 61L, 61L, 60L, 59L, 58L, 57L, 56L, 56L, 56L, 56L, 55L ), .Label = c("17.8", "18.5", "19", "19.1", "19.2", "19.3", "19.6", "19.9", "20.2", "20.6", "20.7", "21.4", "22.2", "22.5", "23.1", "23.3", "24.4", "12", "12.2", "12.7", "12.9", "13.3", "13.6", "14.2", "14.7", "14.8", "14.9", "15", "16.7", "17.1", "18.6", "18.9", "5.1", "5.4", "5.5", "5.8", "6.1", "6.2", "6.3", "6.4", "6.7", "7.5", "7.8", "7.9", "8.4", "8.5", "9.3", "4.9", "5", "5.2", "5.3", "5.6", "5.7", "5.9", "0.1", "0.2", "0.3", "0.4", "0.7", "0.8", "1", "1.4", "1.6", "1.7", "1.9"), class = "factor")), .Names = c("ID", "divisions", "divs_20", "mean20"), row.names = c(NA, -100L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000000220788>)