Permalink
Browse files

Wrap parallel file parsing in fatal exception handler (#33297)

Parallel.For operations wrap exceptions in an AggregateException, which
destroys dump information. This change should crash the process on a parse
exception and preserve the dump information for Watson.
  • Loading branch information...
agocke committed Feb 11, 2019
1 parent 5571adf commit 83fc2b5f804925387b1f2bfeee9ad7ee994941d4
@@ -52,8 +52,15 @@ public override Compilation CreateCompilation(TextWriter consoleOutput, TouchedF
{
Parallel.For(0, sourceFiles.Length, UICultureUtilities.WithCurrentUICulture<int>(i =>
{
//NOTE: order of trees is important!!
trees[i] = ParseFile(parseOptions, scriptParseOptions, ref hadErrors, sourceFiles[i], diagnosticBag, out normalizedFilePaths[i]);
try
{
//NOTE: order of trees is important!!
trees[i] = ParseFile(parseOptions, scriptParseOptions, ref hadErrors, sourceFiles[i], diagnosticBag, out normalizedFilePaths[i]);
}
catch (Exception e) when (FatalError.Report(e))
{
throw ExceptionUtilities.Unreachable;
}
}));
}
else
@@ -94,8 +94,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Parallel.For(0, sourceFiles.Length,
UICultureUtilities.WithCurrentUICulture(Of Integer)(
Sub(i As Integer)
' NOTE: order of trees is important!!
trees(i) = ParseFile(consoleOutput, parseOptions, scriptParseOptions, hadErrors, sourceFiles(i), errorLogger)
Try
' NOTE: order of trees is important!!
trees(i) = ParseFile(consoleOutput, parseOptions, scriptParseOptions, hadErrors, sourceFiles(i), errorLogger)
Catch ex As Exception When FatalError.Report(ex)
Throw ExceptionUtilities.Unreachable
End Try
End Sub))
Else
For i = 0 To sourceFiles.Length - 1

0 comments on commit 83fc2b5

Please sign in to comment.