Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio msbuild日志输出已中断_Visual Studio_Logging_Msbuild - Fatal编程技术网

Visual studio msbuild日志输出已中断

Visual studio msbuild日志输出已中断,visual-studio,logging,msbuild,Visual Studio,Logging,Msbuild,使用MSBuild构建Visual Studio解决方案时,我们注意到结果日志输出以某种方式混淆: 6>foo.cpp(819): warning C4100: "param1": unreferenced formal parameterbar.cpp(388): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable dep

使用MSBuild构建Visual Studio解决方案时,我们注意到结果日志输出以某种方式混淆:

6>foo.cpp(819): warning C4100: "param1": unreferenced formal parameterbar.cpp(388): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\src\myproject.vcxproj]

         C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(2254): note: see declaration of "sscanf"foo.cpp(819): warning C4100: "param2": unreferenced formal parameter
在我看来,这就像多个线程在没有适当同步的情况下写入文件一样。但是,请注意,生成订单号(本例中为6)只显示一次。此摘录周围的行看起来正常,但日志中会出现类似的错误。我们可以在每个构建中重现类似的问题。问题出现在标准输出和日志文件中

使用以下参数调用msbuild:

/m /p:Configuration=Release /t:rebuild /nr:false /FileLogger /Verbosity:normal /ds solution.sln
使用的版本为14.0.25420.1

在解析日志以获取有关编译器错误和警告的统计信息时,此问题会导致出现问题。知道是什么引起的吗


编辑

重现问题的步骤:

  • 创建一个新的VisualStudio项目(我选择了一个控制台应用程序),并禁用SDL检查(C4996应该是一个警告,而不是一个错误)
  • 将配置更改为Release,将平台更改为x86(在x64中,警告C4456不知何故未触发?)
  • 将警告级别设置为4(/W4)
  • 启用多处理器编译(/MP)
  • 将具有以下内容的新文件添加到项目中:

    #include <stdafx.h>
    
    #include <cstdio>
    #include <iostream>
    
    void foo()
    {
        int a = 42;
    
        {
            int a = 0;
    
            std::cout << a << std::endl;
        }
    }
    
    void bar()
    {
        char buffer[50];
        int a = 40;
        int b = 2;
        sprintf(buffer, "%d plus %d is %d", a, b, a + b);
    
        std::cout << buffer << std::endl;
    }
    
    #包括
    #包括
    #包括
    void foo()
    {
    INTA=42;
    {
    int a=0;
    
    std::您能给我一个示例和一些重现此问题的详细步骤吗?根据错误,错误似乎来自
    foo.cpp
    而不是MSBuild。如果创建一个新的空白项目并使用您的build命令行生成,它可以正常工作。因此,您也可以创建一个新的空白项目,检查它是否仍然具有此功能sue?@LeoLiu MSFT我试图用一个新项目重现这个问题。它没有出现。在原始解决方案中,问题并不总是出现在同一行,甚至不是同一个文件或项目。但它确实在解决方案中的某个位置出现一致。我怀疑这与并行构建多个文件/项目有关.你有什么想法吗?我可以试着用一个项目复制这个问题,然后发布到这里?@LeoLiu MSFT我终于能够复制这个问题了。我将用细节更新我的问题。