Export (0) Print
Expand All

Common Validation Errors and Warnings in Text Templates 

Warnings and errors for text templates are displayed in the Error List window in Visual Studio. This topic describes the common warnings and errors and where applicable, explains how they can be fixed.

The following table lists the most common errors, and fixes if available.

Error Message Description Solution

Failed to load base class '{0}' from which Transformation class inherits.

Occurs if the base class specified in the inherits parameter in a template directive cannot be found. The line number of the template directive is provided.

Be sure the specified class exists, and that the assembly that it exists in is specified in an assembly directive.

Failed to resolve include text for file:{0}

Occurs when an included template cannot be found. The name of the requested include file is provided.

Make sure that the file path is relative to the original template path, or that the file is in a location that is registered with the host, or that the full path to the file is provided.

Errors were generated when initializing the transformation object. The transformation will not be run.

Occurs when the 'Initialize()' of the transformation class failed or returned false.

The code in the Initialize() function comes from the base transformation class specified in the <#@template#> directive, and from directive processors. The error that caused initialize to fail is likely to be also on the error list. Investigate why it failed. You can look at the actual generated code for Initialize() by following the procedures to debug a template.

The assembly '{0}' for directive processor '{1}' was not granted the FullTrust permission set. Only trusted assemblies are allowed to provide directive processors. This directive processor will not be loaded.

Occurs when an assembly containing a directive processor is not granted FullTrust permissions by the system. The name of the assembly and the name of the directive processor are provided.

Ensure that you only use trusted assemblies on the local machine.

The path '{<path>' must be either local to this computer or part of your trusted zone.

Occurs when a directive or assembly directive references a file that is not on your local machine or on your network's trusted zone.

Ensure that the directory where the directive or assembly directives are located is in your trusted zone. You can add a netword directory to your trusted zone through Internet Explorer.

The following table lists the most common warnings along with fixes, if available.

Warning Message Description Solution

Loading the include file '{0}' returned a null or empty string.

Occurs if an included text template file is blank. The file name of the included file are provided.

Remove the include directive, or be sure the file has some content.

Compiling transformation:

This string is prepended to all errors or warnings originating from the compiler when compiling the transformation. This string means that the compiler threw an error or warning.

If it is a problem is with finding the DLL, you may need to provide the full path, or provide a fully qualified strong name if the DLL is in the GAC.

The parameter '{0}' already exists in the directive. The duplicate parameter will be ignored.

Occurs when a parameter is specified more than once in a directive. The name of the parameter and the line number of the directive are provided.

Remove the duplicate parameter specification.

There was an error loading the include file '{0}'. The include directive will be ignored.

Occurs when a file specified in an include directive cannot be found. The name of the file and the line number of the directive are provided.

Be sure the include file exists in the same directory as the original text template file, or in one of the include directories that are registered with the host. For more information, see How to: Include Files in Text Templates.

An invalid base class was specified for the Transformation class. The base class must derive from Microsoft.VisualStudio.TextTemplating.TextTransformation.

Occurs when the inherits parameter in a template directive specifies a class that does not inherit from TextTransformation. The line number of the template directive is provided.

Specify a class that derives from TextTransformation.

An invalid culture was specified in the 'template' directive. The culture must be in the "xx-XX" format. The invariant culture will be used.

Occurs when the culture parameter in a template directive is specified incorrectly. The line number of the template directive is provided.

Change the culture parameter to a valid culture in the "xx-XX" format. For more information, see How to: Specify a Culture in Text Templates.

An invalid debug value '{0}' was specified in the template directive. The debug value must be either "true" or "false". The default of "false" will be used.

Occurs when the debug parameter in a template directive is specified incorrectly. The line number of the template directive is provided.

Set the debug parameter to "true" or "false".

An invalid HostSpecific value '{0}' was specified in the template directive. The HostSpecific value must be either "true" or "false". The default of "false" will be used.

Occurs when the host-specific parameter in a template directive is specified incorrectly. The line number of the template directive is provided.

Set the host-specific parameter to "true" or "false".

An invalid language '{0}' was specified in the 'template' directive. The language must be either "C#" or "VB". The default value of "C#" will be used.

Occurs when an unsupported language is specified in the template directive. Only "C#" or "VB" are allowed (case insensitive). The line number of the template directive is provided.

Set the language parameter in the template directive to "C#" or"VB".

Multiple output directives were found in the template. All but the first one will be ignored.

Occurs when multiple output directives are specified in a template file. The line number of the duplicate output directive are provided.

Remove duplicate output directives.

Multiple template directives were found in the template. All but the first one will be ignored. Multiple parameters to the template directive should be specified within one template directive.

Occurs if you specify multiple template directives within a text template file (including included files). The line number of the duplicate template directive are provided.

Aggregate the different template directives into one template directive.

No processor was specified for a directive named '{0}'. The directive will be ignored.

Occurs if you specify a custom directive but do not provide a processor attribute. The name of the directive and the line number are provided.

Provide a processor attribute with the name of the directive processor for the directive.

A processor named '{0}' could not be found for the directive named '{1}'. The directive will be ignored.

Occurs when the directive processor you specified within a custom directive cannot be found. The directive name, processor name, and the line number of the directive are provided.

Set the processor attribute in the directive to the name of the directive processor.

A required parameter '{0}' for the directive '{1}' was not found. The directive will be ignored.

Occurs when a required directive parameter is not provided. The name of the missing parameter, the directive name, and the line number are provided.

Provide the missing parameter.

The processor named '{0}' does not support the directive named '{1}'. The directive will be ignored.

Occurs when a directive processor does not support a directive. The name and line number of the offending directive are shown along with the name of the directive processor.

Correct the name of the directive.

The include directive for file '{0}' causes an infinite loop.

Displayed if circular include directives are specified (for example, file A includes file B, which includes file A).

Do not specify circular include directives.

Running transformation:

This string is prepended to all errors or warnings that are generated while running the transform.

Not applicable.

An unexpected start or end tag was found within a block. Make sure that you did not mis-type a start or end tag, and that you don't have any nested blocks in the template.

Displayed when you have an unexpected <# or #>. That is, if you have a <# after another open tag that has not been closed, or you have a #> when there is no unclosed open tag before it. The line number of the mismatched tag is provided.

Remove the mismatched start or end tag, or use an escape character.

A directive was specified in the wrong format. The directive will be ignored. Please specify the directive in the format <#@ name [parametername="parametervalue"]* #>

Displayed by the parser if a directive is not specified in the correct format. The line number of the incorrect directive is provided.

Make sure all directives are in the form <#@ name [parametername="parametervalue"]* #>. For more information, see Directive Syntax (Domain-Specific Languages).

Failed to load Assembly '{0}' for registered directive processor '{1}'

{2}

Occurs when a directive processor could not be loaded by the host. The assembly provided for the directive processor and the name of the directive processor are provided.

Make sure the directive processor is registered correctly and that the assembly exists.

Failed to find type '{0}' in Assembly '{1}' for registered directive processor '{2}'

{3}

Occurs when a directive processor type could not be loaded from its assembly. The name of the type, assembly, and directive processor are provided.

The vshost finds directive processor information (name, assembly and type) in the registry. Make sure the directive processor is registered correctly, and that the type exists in the assembly.

There was a problem loading the assembly '{0}'

Occurs when there is a problem loading an assembly. The name of the assembly is provided.

Assemblies to be loaded can be specified in <@#assembly#> directives, and by directive processors. The error message that follows this string should give more data on why the assembly load failed.

There was a problem creating and initializing the processor for a directive named '{1}'. The type of the processor is {0}. The directive will be ignored.

Occurs when a directive processor could not be created or initialized. The name and line number of the directive and the type of the processor are provided.

Make sure you are using the correct directive processor, and that the directive processor has a public default constructor. Otherwise investigate why the Initialize() method of the directive processor is failing using the debug options. For more information, see How to: Debug Text Templates.

An Exception was thrown while processing a directive named '{0}'.

Occurs when a directive processor throws an exception when processing a directive.

Ensure that the parameters to the directive processor are correct.

The host threw an exception while trying to resolve the assembly reference '{0}'.

Occurs when the host throws an exception when trying to resolve an assembly reference. The assembly reference string is provided.

Assembly references come from <@#assembly#> directives and from directive processors. Ensure that the 'name' parameter provided in the assembly parameter is correct.

Attempt to specify unsupported {1} value '{0}' for directive {2}

Occurs by the RequiresProvidesDirectiveProcessor (all our generated directive processors derive from it), when you supply an unsupported requires or provides argument.

Ensure that the names in the name='value' pairs provided in the requires and provides parameters are correct.

Community Additions

ADD
Show:
© 2014 Microsoft