dotnet / dotnet/msbuild

Killed build .binlogs are empty

Open
#3,815 2 comments 0 reactions 1 assignee Claimed by @KirillOsenkov View on GitHub
Area: Logging triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### **Problem: When I forcefully finish the execution of MSBuild.exe it doesn't flush any information to .binlog**

#### Scenario to repro it:

I have a custom task like so:

```c#
public class TaskTeste : Task, ICancelableTask
{
private readonly CancellationTokenSource cts = new CancellationTokenSource();

public void Cancel() => cts.Cancel();

public override bool Execute()
{
return cts.Token.WaitHandle.WaitOne(TimeSpan.FromSeconds(5));
}
}
```

and I've a `.proj` file that uses it, like so:

```xml




```

and I execute the project like this:

```powershell
msbuild Testing.proj /bl:InnerCall.binlog
```

and after a few seconds I kill the `msbuild.exe` process using:

```
taskkill /F /IM msbuild.exe
```

After this, I expected the `innerCall.binlog` file to contain some information about the project execution. But it turns out the file is always empty. By the way, an `InnerCall.ProjectImports.zip` file is created, however that file isn't created when I let the process successfully finish.

Cc: @rainersigwald

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.