Skip to content

Don't log named pipe connection failures as errors in BuildServerConnection#82609

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-ioexception-reporting
Open

Don't log named pipe connection failures as errors in BuildServerConnection#82609
Copilot wants to merge 3 commits intomainfrom
copilot/fix-ioexception-reporting

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

When connecting to the compiler server fails due to a timeout, pipe ownership mismatch, or other exception, the previous LogException/LogError calls emitted messages prefixed with "Error Error:" or "Error:". This matches the canonical error pattern that MSBuild's Exec task detects in process output, causing it to surface a build error — even though these are transient, recoverable conditions where the compiler falls back gracefully to the command-line tool.

Change

In BuildServerConnection.cs, replace LogException/LogError with plain Log for all three recoverable failure paths in TryConnectToServerAsync. Key diagnostic info (exception type + message) is retained; only the "Error:" prefix is dropped.

- logger.LogException(e, $"Connecting to server timed out after {timeoutMs} ms");
+ logger.Log($"Connecting to server timed out after {timeoutMs} ms: '{e.GetType().Name}' '{e.Message}'");

- logger.LogError("Owner of named pipe is incorrect");
+ logger.Log("Owner of named pipe is incorrect");

- logger.LogException(e, "Exception while connecting to process");
+ logger.Log($"Exception while connecting to process: '{e.GetType().Name}' '{e.Message}'");

LogException/LogError are appropriate for unexpected failures. These connection failures are all handled, recoverable conditions — logging them as errors was misleading.

Original prompt

This section details on the original issue you should resolve

<issue_title>Error Error: 'IOException' 'The semaphore timeout period has expired reported but not really an issue</issue_title>
<issue_description>10.0.103:

During building with Visual Studio 2026 18.3.0 we encounter the following:

EXEC(0,0): Error Error: 'IOException' 'The semaphore timeout period has expired.

It appears that this error is reported, but the build is not failing as a retry is done, but as the error is reported as a canonical error format the exec msbuild task https://learn.microsoft.com/en-us/visualstudio/msbuild/exec-task?view=visualstudio reports an error and stops.

But as this is not really an error as dotnet build is not stopping can the following line be adapted that, it does not report an canonical error

https://github.com/dotnet/roslyn/blob/main/src/Compilers/Shared/BuildServerConnection.cs#L415

</issue_description>

Comments on the Issue (you are @copilot in this section)

@jjonescz > the exec msbuild task https://learn.microsoft.com/en-us/visualstudio/msbuild/exec-task?view=visualstudio reports an error and stops.

I'm not sure what do you mean by this. Where exactly is this Exec task being used? There shouldn't be any Exec task used during normal dotnet build when invoking the C# compiler.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

When a named pipe connection times out (IOException/TimeoutException),
the previous LogException call generated "Error Error: 'IOException'
'The semaphore timeout period has expired.'" which matches a canonical
error format, causing MSBuild's Exec task to treat it as a build error.

Since connection timeout is a recoverable/transient condition (the
caller retries or falls back to command-line), change to a plain
logger.Log call that preserves the diagnostic info without the
"Error:" prefix.

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix IOException reporting during Visual Studio build Don't log named pipe connection timeout as an error Mar 3, 2026
Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…nection.cs

Same issue: pipe ownership failure and general connect exceptions are
also recoverable (both return null → fallback to CLI compiler), so they
should not be logged with an "Error:" prefix that could trigger
MSBuild's canonical error detection.

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title Don't log named pipe connection timeout as an error Don't log named pipe connection failures as errors in BuildServerConnection Mar 3, 2026
@jjonescz jjonescz requested a review from jaredpar March 3, 2026 18:03
@jjonescz jjonescz marked this pull request as ready for review March 3, 2026 22:47
@jjonescz jjonescz requested a review from a team as a code owner March 3, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error Error: 'IOException' 'The semaphore timeout period has expired reported but not really an issue

2 participants