Closed TomBruns closed 2 years ago
In some error scenarios the Output property (instead of the Errors property) is populated on the CompilerResults object
In these cases the library returns the less helpful "Unknown compiler error" message
Suggested chgs in Evaluator.CodeDom in Compile method at the bottom summary: if Errors is empty but Output is populated => use it,
if (result.Errors.IsEmpty() && result.Output.IsEmpty()) { // unknown error; e.g. invalid compiler params result.Errors.Add(new CompilerError { ErrorText = "Unknown compiler error\n" + sdk_warning }); } else if (!result.Errors.IsEmpty()) { // always prefer info from Errors property } else if (!result.Output.IsEmpty()) { foreach (var outputMsg in result.Output) { result.Errors.Add(new CompilerError { ErrorText = $"{outputMsg}\n" }); } } throw CompilerException.Create(result.Errors, true, true); }
Excellent suggestion. Txs. Done. I only changed your solution logic to avoid the accidental breakdown of a single error in multiple CompileError objects. Will be available in the very next release.
CompileError
In some error scenarios the Output property (instead of the Errors property) is populated on the CompilerResults object
In these cases the library returns the less helpful "Unknown compiler error" message
Suggested chgs in Evaluator.CodeDom in Compile method at the bottom summary: if Errors is empty but Output is populated => use it,