Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/Build/BackEnd/Components/Logging/EventSourceSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,11 @@ private void RaiseProjectStartedEvent(object sender, ProjectStartedEventArgs bui
// if a logger has failed politely, abort immediately
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
UnregisterAllEventHandlers();
throw;
}
catch (Exception exception)
{
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();

if (ExceptionHandling.IsCriticalException(exception))
{
throw;
Expand Down Expand Up @@ -873,9 +869,9 @@ private void RaiseAnyEvent(object sender, BuildEventArgs buildEvent)
// if a logger has failed politely, abort immediately
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
UnregisterAllEventHandlers();

// We ought to dump this farther up the stack, but if for example a task is logging an event within a
// We ought to dump this further up the stack, but if for example a task is logging an event within a
// catch(Exception) block and not rethrowing it, there's the possibility that this exception could
// just get silently eaten. So better to have duplicates than to not log the problem at all. :)
ExceptionHandling.DumpExceptionToFile(exception);
Expand All @@ -884,11 +880,7 @@ private void RaiseAnyEvent(object sender, BuildEventArgs buildEvent)
}
catch (Exception exception)
{
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();

// We ought to dump this farther up the stack, but if for example a task is logging an event within a
// We ought to dump this further up the stack, but if for example a task is logging an event within a
// catch(Exception) block and not rethrowing it, there's the possibility that this exception could
// just get silently eaten. So better to have duplicates than to not log the problem at all. :)
ExceptionHandling.DumpExceptionToFile(exception);
Expand Down
18 changes: 15 additions & 3 deletions src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -842,13 +842,25 @@ private async Task BuildAndReport()
{
// The build was likely cancelled. We do not need to log an error in this case.
}
else if (_projectLoggingContext is null)
else if (ex is InternalLoggerException)
{
_nodeLoggingContext.LogError(BuildEventFileInfo.Empty, "UnhandledMSBuildError", ex.ToString());
string realMessage = ex.Message;
Exception realEx = ex;
while (realEx.InnerException is not null)
{
realEx = realEx.InnerException;
realMessage = realEx.Message;
}

(((LoggingContext)_projectLoggingContext) ?? _nodeLoggingContext).LogError(
BuildEventFileInfo.Empty,
"FatalErrorWhileLoggingWithInnerExceptionAndStack",
realMessage,
realEx.StackTrace);
}
else
{
_projectLoggingContext.LogError(BuildEventFileInfo.Empty, "UnhandledMSBuildError", ex.ToString());
(((LoggingContext)_projectLoggingContext) ?? _nodeLoggingContext).LogError(BuildEventFileInfo.Empty, "UnhandledMSBuildError", ex.ToString());
}

if (ExceptionHandling.IsCriticalException(ex))
Expand Down
8 changes: 8 additions & 0 deletions src/Build/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@
likely because of a programming error in the logger). When a logger dies, we cannot proceed with the build, and we throw a
special exception to abort the build.</comment>
</data>
<data name="FatalErrorWhileLoggingWithInnerExceptionAndStack" xml:space="preserve">
<value>MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
{0}
{1}</value>
<comment>{StrBegin="MSB4017: "}UE: This message is used for a special exception that is thrown when a logger fails while logging an event (most
likely because of a programming error in the logger). When a logger dies, we cannot proceed with the build, and we throw a
special exception to abort the build.</comment>
</data>
<data name="General.TwoVectorsMustHaveSameLength">
<value>MSB3094: "{2}" refers to {0} item(s), and "{3}" refers to {1} item(s). They must have the same number of items.</value>
<comment>{StrBegin="MSB3094: "}</comment>
Expand Down
11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Build/Resources/xlf/Strings.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.