dotnet / dotnet/msbuild

[BuildCheck Suggestion]: Flag Process.Start usages

Open
#10,989 3 comments 0 reactions 0 assignees View on GitHub
Area: BuildCheck BuildCheck Suggestion triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

`Process.Start` from within custom task should be flagged and usage of `Exec` or `ToolTask` tasks should be suggested.

### On Hold (!)

Let's not action upon this yet. Let's first have a sample demonstrative case that'd be breaking the MSBuild server (plus see if it actually isn't already broken with the curent long lived nodes) and only then decide whether we want to restrict it.

Then we might possibly want to resort to compiler analyzer (or banned API) if runtime checks proves complicted

### Background and Motivation

`Process.Start` creates child processes that cannot be easily controlled by MSBuild engine (as opposed to using `Exec` or `ToolTask` tasks). This can e.g. lead to issues during MSBuild server adoption (issue with redirecting outputs)

### Notes

Possible ways to detect the Process.Start (need to be investigated if doable):
* Injecting reroute function for `Process.Start` (akin unittest mocking)
* .net profiling API
* Monitor for child process creation (akin child process debugging)

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.