question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The binlog for a static_assert excludes the most important piece of information

See original GitHub issue

Issue moved from dotnet/msbuild#8019


From @dmachaj on Friday, September 30, 2022 5:11:03 PM

Issue Description

We use some header files that have static asserts in them (see https://github.com/microsoft/wil). When those static asserts are violated there is a build break. The error output has the file/line information for the static_assert in WIL. However, the most important information is the file/line of the code in our project that uses WIL. This output is in the console but is missing from msbuild and the binlog file.

Steps to Reproduce

  1. Using Visual Studio 2022 17.3 create an empty Windows Console application project.
  2. Fill in the files as described below.
  3. msbuild MSBuildOutputReproProject.sln /bl
  4. Open the msbuild.binlog file in the MSBuild Structured Log Viewer

ConsoleApplication1.cpp

#include <iostream>
#include "StaticAssertHeader.h"

int main()
{
    std::cout << "Hello World!\n";
    DoStuff(1);
    DoStuff(1.0);
}

StaticAssertHeader.h

#pragma once

template <typename T>
void DoStuff(T value)
{
    static_assert(std::is_same<T, int>());
}

Console output

  ConsoleApplication1.cpp
v:\code\MSBuildOutputReproProject\ConsoleApplication1\StaticAssertHeader.h(6,39): error C2338: static_assert failed: 's
td::is_same<T, int>()' [v:\code\MSBuildOutputReproProject\ConsoleApplication1\ConsoleApplication1.vcxproj]
v:\code\MSBuildOutputReproProject\ConsoleApplication1\ConsoleApplication1.cpp(11): message : see reference to function
template instantiation 'void DoStuff<double>(T)' being compiled [v:\code\MSBuildOutputReproProject\ConsoleApplication1\
ConsoleApplication1.vcxproj]
          with
          [
              T=double
          ]

Binlog content

v:\code\MSBuildOutputReproProject\ConsoleApplication1\StaticAssertHeader.h(6,39): error C2338: static_assert failed: 'std::is_same<T, int>()' [v:\code\MSBuildOutputReproProject\ConsoleApplication1\ConsoleApplication1.vcxproj]
see reference to function template instantiation 'void DoStuff<double>(T)' being compiled
        with
        [
            T=double
        ]
The command exited with code 2.

Note that ConsoleApplication1.cpp(11) is missing from the binlog. This is the most important piece of information in the output.

Expected Behavior

The binlog should contain the full set of compiler output. It is missing the most important line with the file/line information.

Actual Behavior

The file/line information for the calling code is missing. Without this it is not possible to locate the error in a large code base. I must pipe the output to a txt file and search it for the errors. That is a much worse experience than using the binlog viewer.

Analysis

Versions & Configurations

MSBuild version 17.3.1+2badb37d1 for .NET Framework 17.3.1.41501

This device is running Windows 11 (2022 update).

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
KirillOsenkovcommented, Oct 6, 2022

Published in 2.1.728

0reactions
dmachajcommented, Oct 6, 2022

Wow that was impressively fast. I just got a notice that there is a new version of the log viewer. When restarted it has your fix. I now see the expected information 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

The binlog for a static_assert excludes the most important piece ...
The binlog should contain the full set of compiler output. It is missing the most important line with the file/line information. Actual Behavior....
Read more >
storage/innobase/include/log0constants.h Source File
178/** Offset within the log file header, to the field which stores the log_uuid. 179The log_uuid is chosen after a new data directory...
Read more >
MySQL: storage/innobase/include/dict0types.h Source File
16This program is distributed in the hope that it will be useful, but WITHOUT ... 66/** Partition separator length excluding terminating NULL */....
Read more >
platform/hardware/interfaces
+ // Any exclude rule being satisfied invalidates the whole ... + * This is a low-level access method unlikely to be useful...
Read more >
MySQL NDB Cluster 8.0 Release Notes
Abstract. This document contains release notes for the changes in each release of MySQL NDB Cluster that uses version 8.0 of the NDB...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found