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

LogCustomEvent causes build to "hang" in .NET 5 #5850

Open
jonathanpeppers opened this issue Nov 2, 2020 · 0 comments
Open

LogCustomEvent causes build to "hang" in .NET 5 #5850

jonathanpeppers opened this issue Nov 2, 2020 · 0 comments

Comments

@jonathanpeppers
Copy link
Member

Issue Description

It appears that our usage of BuildEngine.LogCustomEvent() causes Xamarin.Android builds to hang when running on .NET 5. We are currently working toward Android support in .NET 6.

I originally thought Xamarin.Build.AsyncTask was at fault. But then I attached a debugger and saw weird behavior after the first LogCustomEvent() call. After this I was seeing Log.LogMessage() calls go through that did not appear in the MSBuild log output. I even saw Execute() return successfully, but the build appears to be stuck at this point. There still may be something we are doing wrong in Xamarin.Build.AsyncTask, let me know.

We can comment out all the LogCustomEvent() calls to fix the issue. It also appears to work fine on .NET framework and Mono.

Steps to Reproduce

Use this project on the dotnet-build-hang branch, and follow the installation instructions on the README:

https://github.com/xamarin/net6-samples/tree/dotnet-build-hang

Run this command with an Android emulator or device attached:

dotnet build -t:Install .\UnnamedProject\UnnamedProject.csproj -v:diag

Removing -v:diag also solves the issue as well.

Expected Behavior

dotnet build completes.

Actual Behavior

dotnet build will block indefinitely. Ctrl+C does not stop either, you will need to kill the process.

Analysis

One thing I noticed that may/may not be related is that dotnet build uses the -distributedlogger switch:

-distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\5.0.100-rtm.20509.5\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\5.0.100-rtm.20509.5\dotnet.dll"

While .NET framework MSBuild doesn't use this at all.

Versions & Configurations

> dotnet msbuild /version
Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

16.8.0.47505

Windows 10 1903

Attach a binlog

.binlog is not very useful as I had to kill the process, I used -flp:Verbosity=diag to get more info:

logs.zip

@jonathanpeppers jonathanpeppers added bug needs-triage Have yet to determine what bucket this goes in. labels Nov 2, 2020
@benvillalobos benvillalobos self-assigned this Nov 4, 2020
@KirillOsenkov KirillOsenkov self-assigned this Jan 30, 2021
@benvillalobos benvillalobos removed the needs-triage Have yet to determine what bucket this goes in. label May 21, 2021
@benvillalobos benvillalobos removed their assignment May 21, 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

4 participants