Buildalyzer icon indicating copy to clipboard operation
Buildalyzer copied to clipboard

Intermittent error "Could not find build environment"

Open lostmsu opened this issue 4 years ago • 0 comments

This is the same issue as #125 , except now the problem is dotnet --info sometimes does not make it in 4 seconds (I am running a lot of concurrent analyzers). See hardcoded timeout in https://github.com/daveaglick/Buildalyzer/blob/da88770a2952f7894c05cd0866ef9d766f78aaea/src/Buildalyzer/Environment/DotnetPathResolver.cs#L63

I have 3 options for solving/improving it:

  1. Don't impose a timeout at all in that particular method.
  2. Pass around CancellationToken and let the caller handle timeout conditions.
  3. (incomplete solution) Increase timeout interval or make it configurable.
  4. (incomplete solution) In that particular method, use WaitForExit with timeout in a loop. Continue looping if during the last 4 seconds dotnet --info added some output.

Additionally, it is not clear to me right now why the output of dotnet --info can not be cached after the first run (per dotnet path). Environment variables for that call are hardcoded, and the only thing that's changing is the current directory, which can only affect result in a narrow case: running on Windows (or on *nix with PATH env var containing .), and there's a dotnet.exe next to the project file.

lostmsu avatar Mar 24 '21 02:03 lostmsu