Редагувати

Поділитися через


CodeGenerator.ValidateIdentifiers(CodeObject) Method

Definition

Attempts to validate each identifier field contained in the specified CodeObject or System.CodeDom tree.

public:
 static void ValidateIdentifiers(System::CodeDom::CodeObject ^ e);
public static void ValidateIdentifiers (System.CodeDom.CodeObject e);
static member ValidateIdentifiers : System.CodeDom.CodeObject -> unit
Public Shared Sub ValidateIdentifiers (e As CodeObject)

Parameters

e
CodeObject

An object to test for invalid identifiers.

Exceptions

The specified CodeObject contains an invalid identifier.

Remarks

It is possible for the identifier fields of CodeObject objects to contain field escape characters and hidden code which can allow security violations. This method checks the literal fields of each CodeObject in a System.CodeDom tree for characters which could be used to hide code, and throws an exception if an identifier field contains an invalid character.

This method calls the IsValidLanguageIndependentIdentifier method to validate each identifier in the specified CodeObject or System.CodeDom tree, and throws an exception if an identifier is invalid or contains invalid characters.

Call this method and pass it the CodeCompileUnit containing the code graph to generate before generating code to block the use of certain character sequences that can be used to include hidden code within an identifier field. This method is not called automatically by any generate code methods.

Applies to

See also