Skip to content

Commit

Permalink
Log exception to EnC log (#69401)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat authored Aug 4, 2023
1 parent e42f43e commit 1a8b8fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Features/Core/Portable/EditAndContinue/EditSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,10 @@ internal static void MergePartialEdits(

public async ValueTask<SolutionUpdate> EmitSolutionUpdateAsync(Solution solution, ActiveStatementSpanProvider solutionActiveStatementSpanProvider, UpdateId updateId, CancellationToken cancellationToken)
{
var log = EditAndContinueService.Log;

try
{
var log = EditAndContinueService.Log;

log.Write("EmitSolutionUpdate {0}.{1}: '{2}'", updateId.SessionId.Ordinal, updateId.Ordinal, solution.FilePath);

using var _1 = ArrayBuilder<ManagedHotReloadUpdate>.GetInstance(out var deltas);
Expand Down Expand Up @@ -1112,10 +1112,16 @@ async ValueTask LogDocumentChangesAsync(int? generation, CancellationToken cance

return update;
}
catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))
catch (Exception e) when (LogException(e) && FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))
{
throw ExceptionUtilities.Unreachable();
}

bool LogException(Exception e)
{
log.Write("Exception while emitting update: {0}", e.ToString());
return true;
}
}

private async ValueTask LogDeltaFilesAsync(TraceLog.FileLogger log, ManagedHotReloadUpdate delta, int baselineGeneration, Project oldProject, Project newProject, CancellationToken cancellationToken)
Expand Down

0 comments on commit 1a8b8fe

Please sign in to comment.