Msbuild: Log our own error if a task returned false but didn't log any errors

Created on 1 May 2017  路  10Comments  路  Source: dotnet/msbuild

If a task violates the implicit expectation that it should return false iff it logged any errors MSBuild fails the build, but doesn't indicate why.

We should consider at least adding a warning, but ideally failing the build (perhaps in strict mode?)

Debuggability Feature Request Warning Waves User Experience up-for-grabs

Most helpful comment

Let's just do this in the first preview of 16.5. YOLO and this keeps biting people. Any objections?

All 10 comments

@KirillOsenkov We had discussed overriding a task result if it logged errors but decided it would have too large of an impact. I haven't actually seen a task that logs an error but doesn't return false. Have you hit this a lot?

Just once, but it hurt enough ;) The symptoms is you get all green/gray output (no red), and a Build failed in the end. Good luck.

Structured Log Viewer just showed a Build failed at the end with no other errors. Had to painstakingly read everything until I stumbled at a message from the task at fault that gave me the hint.

We definitely need at least a warning here.

Oh, and its the other case: it returns false, but doesn't log an error.

We've definitely talked about this before but I couldn't find a bug. It does seem entirely reasonable to inject an "error MSBXXXX: Task X returned failure but did not log an error" while still in the logging context of the task. Not sure how easy that would be.

Note that this wouldn't be a breaking change because their build fails anyway, it's just the log doesn't have any errors displayed.

Does the log contain the value of what the task returned? If not, maybe that could be something to consider.

Let's just do this in the first preview of 16.5. YOLO and this keeps biting people. Any objections?

:heart:

Sounds good to me.

We pulled this out of 16.6 because of #5203. Reactivating--we'll aim for 16.7.

Was this page helpful?
0 / 5 - 0 ratings