Msbuild: Binlog missing imported files

Created on 19 Aug 2019  路  6Comments  路  Source: dotnet/msbuild

Steps to reproduce

Command line

mkdir repro
cd repro
dotnet new console
msbuild /bl

Open msbuild.binlog in viewer, go to Files tab

Expected behavior

All imported files are present

Actual behavior

Only the root project file is present.

Example binlog: msbuild.binlog.zip

Environment data

This appears to be a recent regression.

Both of the following are affected:

Microsoft (R) Build Engine version 16.3.0-preview-19412-01+01797ab10 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Build Engine version 16.3.0-preview-19409-03+c1f5c6f00 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

The following is not affected

Microsoft (R) Build Engine version 16.3.0-preview-19377-01+dd8019d9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Debuggability regression

Most helpful comment

You can play back the binlog to view the events:
msbuild msbuild.binlog /v:diag | clip and then paste into a text editor.

All 6 comments

@rainersigwald @dsplaisted @KirillOsenkov

This regression was introduced by #4485, but I don't know how or why. I just eyeballed the commits in that range and it was the second one on my short list; reverting it seems to have fixed the problem.

@BenVillalobos can you figure out what went wrong and add a test that catches the problem?

The Importing project events are missing from the log. Investigate why these events aren't being raised:
https://source.dot.net/#Microsoft.Build.Framework/ProjectImportedEventArgs.cs,8141396abad6d0eb

You should expect something like this:

Importing project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets" into project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets" at (4,3).

You can play back the binlog to view the events:
msbuild msbuild.binlog /v:diag | clip and then paste into a text editor.

For those that run into this issue, the workaround is setting the MSBUILDLOGIMPORTS environment variable to 1

Was this page helpful?
0 / 5 - 0 ratings