Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic build log not emitting properties anymore? #6609

Open
jonathanpeppers opened this issue Jun 22, 2021 · 17 comments
Open

Diagnostic build log not emitting properties anymore? #6609

jonathanpeppers opened this issue Jun 22, 2021 · 17 comments

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Jun 22, 2021

Issue Description

We first noticed this through Maestro bumps:

We have a unit test that is asserting several MSBuild properties are in the diagnostic MSBuild log:

build.zip

It's looking for text like AndroidSdkBuildToolsVersion = . I see this as parameters to tasks, but that's it.

That's when I noticed I'm seeing env vars in this log but not properties? Did we regress on that? Thanks!

Steps to Reproduce

I think, just build a project with /flp1:LogFile=build.log;Verbosity=diag and look for properties in the file?

Expected Behavior

Properties are in diagnostic build logs.

Actual Behavior

I don't see properties in diagnostic build logs?

Versions & Configurations

.NET 6.0.100-preview.6.21321.13

Attach a binlog

I don't really see properties in here either:

msbuild.zip

@jonathanpeppers jonathanpeppers added bug needs-triage Have yet to determine what bucket this goes in. labels Jun 22, 2021
jonathanpeppers added a commit to dotnet/android that referenced this issue Jun 22, 2021
Context: dotnet/msbuild#6609

It seems that properties are missing from MSBuild logs, ignoring part of this test for now.
@rainersigwald
Copy link
Member

From my minimal local testing, this should be fixed in our current build which will flow through soonish. Please let me know if you see this after tomorrow.

(we talked about this offline but commenting here so it's not lost)

jonathanpeppers added a commit to dotnet/android that referenced this issue Jun 22, 2021
Context: dotnet/msbuild#6609

It seems that properties are missing from MSBuild logs, ignoring part of this test for now.
jonathanpeppers added a commit to dotnet/android that referenced this issue Jun 23, 2021
Changes: dotnet/installer@abb57b4...12636f6
Changes: dotnet/linker@21df7db...f90f5c9
Changes: dotnet/runtime@5b8e178...8bb087d

* Update dependencies from https://github.com/dotnet/installer build 20210623.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21313.2 to 6.0.100-preview.6.21323.1

Dependency coherency updates

* Microsoft.NET.ILLink.Tasks: from 6.0.100-preview.6.21304.2 to 6.0.100-preview.6.21314.2
* Microsoft.NETCore.App.Ref: from 6.0.0-preview.6.21306.1 to 6.0.0-preview.6.21317.12

* [tests] temporarily skip asserts in BuildBasicBindingLibrary

Context: dotnet/msbuild#6609

It seems that properties are missing from MSBuild logs, ignoring part of this test for now.

* [templates] set .png files to `copyOnly`

Context: dotnet/templating#3325
Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation

In the current bump, `dotnet new android` + `dotnet build` fails with:

    Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187.

The .NET templating system has a `copyOnly` mode for files that do not
need any text replaced. This is a performance feature, but it also
happens to workaround this issue.

We should be doing this on `.png` files *anyway*, as we don't need
potential "text" to be replaced. I will probably need to make similar
changes in xamarin/xamarin-macios and dotnet/maui.

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
jonathanpeppers added a commit to dotnet/android that referenced this issue Jun 23, 2021
Changes: dotnet/installer@abb57b4...38e12ca
Changes: dotnet/linker@21df7db...c739a81
Changes: dotnet/runtime@5b8e178...24950a3

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 6.0.100-preview.6.21313.2 to 6.0.100-preview.7.21321.2
* Microsoft.NET.ILLink.Tasks: from 6.0.100-preview.6.21304.2 to 6.0.100-preview.6.21317.4
* Microsoft.NETCore.App.Ref: from 6.0.0-preview.6.21306.1 to 6.0.0-preview.7.21319.2

* Remove workarounds for <RuntimeConfigParserTask/>

Context: dotnet/runtime#53811

dotnet/runtime#53811 is now solved, so we can remove the workaround.

* Update .apkdesc files

* [tests] temporarily skip asserts in BuildBasicBindingLibrary

Context: dotnet/msbuild#6609

It seems that properties are missing from MSBuild logs, ignoring part of this test for now.

* [templates] set .png files to `copyOnly`

Context: dotnet/templating#3325
Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation

In the current bump, `dotnet new android` + `dotnet build` fails with:

    Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187.

The .NET templating system has a `copyOnly` mode for files that do not
need any text replaced. This is a performance feature, but it also
happens to workaround this issue.

We should be doing this on `.png` files *anyway*, as we don't need
potential "text" to be replaced. I will probably need to make similar
changes in xamarin/xamarin-macios and dotnet/maui.

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
@jonathanpeppers
Copy link
Member Author

I think this is still happening here: dotnet/android#6046

This should be using 67ba2df.

It looks like the fix in #6520 is there:

/// <summary>
/// Should properties and items be logged on <see cref="ProjectEvaluationFinishedEventArgs"/>
/// instead of <see cref="ProjectStartedEventArgs"/>?
/// </summary>
public bool IncludeEvaluationPropertiesAndItems
{
get
{
if (_includeEvaluationPropertiesAndItems == null)
{
var sinks = _eventSinkDictionary.Values.OfType<EventSourceSink>();
// .All() on an empty list defaults to true, we want to default to false
_includeEvaluationPropertiesAndItems = sinks.Any() && sinks.All(sink => sink.IncludeEvaluationPropertiesAndItems);
}
return _includeEvaluationPropertiesAndItems ?? false;
}
set => _includeEvaluationPropertiesAndItems = value;
}

But maybe there is still a newer commit we need? Let me know, thanks.

@rainersigwald
Copy link
Member

cc @KirillOsenkov in case something jumps out at you here

@jonathanpeppers
Copy link
Member Author

Could it be something about using /bl and /flp1 at the same time? We are basically doing:

/noconsolelogger "/flp1:LogFile=build.log;Encoding=UTF-8;Verbosity=Diagnostic" /bl

We're doing this in some integration tests, just to capture every possible log. If we hit something like a crash, sometimes it was easier to read the text log.

@KirillOsenkov
Copy link
Member

Curious if you play back the binlog, will the properties be there?

@jonathanpeppers
Copy link
Member Author

Replaying the log above & opening it in VS Code, I don't think I see any properties:

dotnet msbuild msbuild.binlog -v:diag | code -

I see the env vars, but not properties:

Environment at start of build:
                   ALLUSERSPROFILE = C:\ProgramData
...

@KirillOsenkov
Copy link
Member

mind sending me both the binlog and the original text log?

@jonathanpeppers
Copy link
Member Author

Oh, they're on the issue above, sorry.

@KirillOsenkov
Copy link
Member

Wow, the properties are not in the binlog, neither on ProjectStarted nor on ProjectEvaluationFinished.

This is alarming. I'm taking a look.

@KirillOsenkov
Copy link
Member

OK I got a repro. The problem is the environment variable MSBUILDNOINPROCNODE=1.

With this set, and a multi-process build /m, there are no properties at all.

@KirillOsenkov
Copy link
Member

So, this environment variable makes stuff weird:

/flp1:v=diag - no props in text log
/flp1:v=diag /bl - props in the text log
/flp1:v=diag /bl /m - no props in the text log

Without it, props are in the text log always.

@KirillOsenkov
Copy link
Member

Well, I understand why properties are not on ProjectStarted. They will only be logged when not running on remote node, and with the environment variable we always run on remote node:

// If we are only logging critical events lets not pass back the items or properties
if (!LoggingService.OnlyLogCriticalEvents &&
!LoggingService.IncludeEvaluationPropertiesAndItems &&
(!LoggingService.RunningOnRemoteNode || LoggingService.SerializeAllProperties))
{

@KirillOsenkov
Copy link
Member

OK, and IncludeEvaluationPropertiesAndItems will be set to false in presence of either console logger or file logger, so that explains why the properties are missing from evaluation either.

/bl - props in the binlog
/bl /m - no props in the binlog
/bl /m /noconlog - props in the binlog

I'd say this behavior is by design.

@KirillOsenkov
Copy link
Member

To have the properties appear on ProjectEvaluationFinished:

To have the properties appear on ProjectStarted:

  • unset the MSBUILDNOINPROCNODE environment variable or set it to 0
  • use single-process build (no multi-proc build)

@KirillOsenkov
Copy link
Member

I'm so used to my change to property logging on evaluation regressing things that I'm relieved that this particular one is not a regression ;)

@rainersigwald
Copy link
Member

We're attempting to set MSBUILDNOINPROCNODE by default for CLI scenarios because it's an observed performance win (we don't lose in-proc caches in the entry-point process's worker node). However this isn't the only regression discovered in that scenario so we've backed it out for preview6. The next build (and the final build) should not have this problem.

@rokonec here's another thing to keep an eye on when we try to re-enable it 😔

@rainersigwald rainersigwald removed the needs-triage Have yet to determine what bucket this goes in. label Jun 30, 2021
@rokonec rokonec mentioned this issue Jul 19, 2021
4 tasks
@rokonec
Copy link
Contributor

rokonec commented Aug 2, 2021

For close future, I will not have time to work at it. Once/if MSBuild server v1 resumes, I will take this one.

@rokonec rokonec removed their assignment Aug 2, 2021
@rokonec rokonec removed their assignment Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants