Update razor precompilation diagnostics:

consistently add razor errors to diagnostics.

This will start producing proper errors with line numbers when Roslyn updates the default diagnostics formatter.
This commit is contained in:
YishaiGalatzer 2014-09-30 12:46:29 -07:00
parent f33eec4845
commit 0ddcd54988
1 changed files with 6 additions and 6 deletions

View File

@ -120,6 +120,12 @@ namespace Microsoft.AspNet.Mvc.Razor
{
var results = _host.GenerateCode(fileInfo.RelativePath, stream);
foreach (var parserError in results.ParserErrors)
{
var diagnostic = parserError.ToDiagnostics(fileInfo.FileInfo.PhysicalPath);
context.Diagnostics.Add(diagnostic);
}
var generatedCode = results.GeneratedCode;
if (generatedCode != null)
@ -143,14 +149,8 @@ namespace Microsoft.AspNet.Mvc.Razor
};
}
}
foreach (var parserError in results.ParserErrors)
{
context.Diagnostics.Add(parserError.ToDiagnostics(fileInfo.FileInfo.PhysicalPath));
}
}
// TODO: Add diagnostics when view parsing/code generation failed.
return null;
}
}