This documentation is archived and is not being maintained.

ITextTemplatingEngineHost.LogErrors Method

Receives a collection of errors and warnings from the text template transformation engine.

Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in microsoft.visualstudio.texttemplating.dll)

void LogErrors (
	CompilerErrorCollection errors
)
void LogErrors (
	CompilerErrorCollection errors
)
function LogErrors (
	errors : CompilerErrorCollection
)

Parameters

errors

The CompilerErrorCollection being passed to the host from the engine.

The engine calls this method when it is done processing a text template, to pass any errors that occurred to the host. The host can decide how to display them. For example the host can display the errors in the user interface, or write them to a file.

The following code example shows a possible implementation for a custom host. In this example the errors are stored in a property. The program that instantiates this custom host will then access the property, and write the errors to the Console. This code example is part of a larger example provided for the ITextTemplatingEngineHost interface.

private CompilerErrorCollection errorsValue;

public void LogErrors(CompilerErrorCollection errors)
{
    errorsValue = errors;
}

The following code example shows another possible implementation for a custom host. In this example the errors are written directly to the Console immediately.

public void LogErrors(CompilerErrorCollection errors)
{
    foreach (CompilerError error in errors)
    {
        Console.WriteLine(error.ToString());
    }
}
Show: