Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit error handling for TaskExtensions.SafeContinueWith #47891

Closed
sharwell opened this issue Sep 21, 2020 · 1 comment · Fixed by #76459
Closed

Revisit error handling for TaskExtensions.SafeContinueWith #47891

sharwell opened this issue Sep 21, 2020 · 1 comment · Fixed by #76459

Comments

@sharwell
Copy link
Member

Version Used: ffa4e6d

Expected Behavior:

  1. In production, asynchronous failures should be reported through non-fatal error handling paths

  2. During tests, asynchronous failures should result in test failures

    • If the failure occurs while a test is running, the failure should produce a single-test failure (as opposed to a FailFast that crashes the runner)
    • If the failure occurs outside the bounds of a test, it should trigger a FailFast

    I believe the easiest way to implement the above is modifying UseExportProviderAttribute to set FatalError.NonFatalHandler at the beginning of a test. This handler would collect exceptions similar to TestExtensionErrorHandler. At the end of a test, the attribute implementation would reset FatalError.NonFatalHandler to a general handler that triggers a FailFast, and then throw any exceptions that were captured during the current test.

@sharwell
Copy link
Member Author

Non-fatal error telemetry exceptions and stack traces are actually logged (to the servicehub folder) when running inside Visual Studio, which means we are already capturing the desired data in roslyn-integration-CI. Capturing the same details for roslyn-CI involves ensuring something like this is running in unit test cases to log errors:

// write the exception to a log file:
var logMessage = $"[{currentProcess.ProcessName}:{currentProcess.Id}] Unexpected exception: {exception}";
foreach (var logger in s_loggers)
{
logger.TraceEvent(TraceEventType.Error, 1, logMessage);
}

Once we know the errors are getting logged, we can add the logs as an artifact attached to the build results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants