Receives a collection of errors and warnings from the transformation engine.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)
Syntax
'宣言
Sub LogErrors ( _
errors As CompilerErrorCollection _
)
'使用
Dim instance As ITextTemplatingEngineHost
Dim errors As CompilerErrorCollection
instance.LogErrors(errors)
void LogErrors(
CompilerErrorCollection errors
)
void LogErrors(
CompilerErrorCollection^ errors
)
function LogErrors(
errors : CompilerErrorCollection
)
Parameters
errors
Type: System.CodeDom.Compiler.CompilerErrorCollectionThe CompilerErrorCollection being passed to the host from the engine.
Remarks
The engine calls this method when it finishes processing a text template and passes 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.
Examples
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 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;
}
Private errorsValue As CompilerErrorCollection
Public Sub LogErrors(ByVal errors As System.CodeDom.Compiler.CompilerErrorCollection) Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.LogErrors
errorsValue = errors
End Sub
The following code example shows another possible implementation for a custom host. In this example, the errors are written to the Console immediately.
public void LogErrors(CompilerErrorCollection errors)
{
foreach (CompilerError error in errors)
{
Console.WriteLine(error.ToString());
}
}
Public Sub LogErrors(ByVal errors As System.CodeDom.Compiler.CompilerErrorCollection) Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.LogErrors
Dim e As CompilerError
For Each e In errors
Console.WriteLine(e.ToString())
Next
End Sub
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Concepts
About Text Template Hosts
Walkthrough: Creating a Custom Text Template Host
Generating Artifacts Using Text Templates
Reference
ITextTemplatingEngineHost Interface
ITextTemplatingEngineHost Members