diff --git a/src/Docfx.Build/HostServiceCreator.cs b/src/Docfx.Build/HostServiceCreator.cs index fb6aea1c646..462b5813afc 100644 --- a/src/Docfx.Build/HostServiceCreator.cs +++ b/src/Docfx.Build/HostServiceCreator.cs @@ -63,8 +63,12 @@ public virtual (FileModel model, bool valid) Load( { if (e is not DocumentException) { + var message = e is ArgumentException or NullReferenceException + ? e.ToString() + : e.Message; + Logger.LogError( - $"Unable to load file '{file.File}' via processor '{processor.Name}': {e.Message}", + $"Unable to load file '{file.File}' via processor '{processor.Name}': {message}", code: ErrorCodes.Build.InvalidInputFile); } return (null, false);