Sdílet prostřednictvím


Understanding Layer Validation Errors

When you validate code against a layer diagram, validation errors occur when the code does not comply with the intended design. This topic helps explain those validation errors and what you can do to resolve or manage them.

Error Syntax and Descriptions

Syntax

Description

ArtifactN(ArtifactTypeN)

ArtifactN is an artifact that is associated with a layer on the layer diagram.

ArtifactTypeN is the type of ArtifactN, such as a Class or Method, for example:

MySolution.MyProject.MyClass.MyMethod(Method)

NamespaceNameN

The name of a namespace.

LayerNameN

The name of a layer on the layer diagram.

DependencyType

The type of dependency relationship between Artifact1 and Artifact2. For example, Artifact1 has a Calls relationship with Artifact2.

Error

Description

AV0001: Invalid Dependency: Artifact1(ArtifactType1) --> Artifact2(ArtifactType2)

   Layers: LayerName1, LayerName2 | Dependencies: DependencyType

Artifact1 in LayerName1 should not have a dependency on Artifact2 in LayerName2 because LayerName1 does not have a direct dependency on LayerName2.

AV1001: Invalid Namespace: Artifact

   Layer: LayerName | Required Namespace: NamespaceName1 | Current Namespace: NamespaceName2

LayerName requires that its associated artifacts must belong to NamespaceName1. Artifact is in NamespaceName2, not NamespaceName1.

AV1002: Depends on Forbidden Namespace: Artifact1(ArtifactType1) | Artifact2(ArtifactType2)

   Layer: LayerName | Forbidden Namespace: NamespaceName | Dependencies: DependencyType

LayerName requires that its associated artifacts must not depend on NamespaceName. Artifact1 cannot depend on Artifact2 because Artifact2 is in NamespaceName.

AV1003: In Forbidden Namespace: Artifact(ArtifactType)

   Layer: LayerName | Forbidden Namespace: NamespaceName

LayerName requires that its associated artifacts cannot belong to NamespaceName. Artifact belongs to NamespaceName.

AV3001: Missing Link: Layer 'LayerName' links to 'Artifact' which cannot be found. Are you missing an assembly reference?

LayerName links to an artifact that cannot be found. For example, a link to a class might be missing because the modeling project is missing a reference to the assembly that contains the class.

AV9001: Architectural analysis found internal errors. Results might not be complete. For more information, see the detailed build event log or output window.

To request more information about this error, see Resources for Troubleshooting Errors in Application Lifecycle Management Tools.

Resolving Layer Validation Errors

The following conditions might cause layer validation errors to occur:

  • An artifact is assigned to the wrong layer. In this case, move the artifact.

  • An artifact, such as a class, uses another class in a way that conflicts with your architecture. In this case, refactor the code to remove the dependency.

To resolve these errors, update the code until no more errors appear during validation. You can perform this task in an iterative manner. To request more information about errors that you encounter, see Resources for Troubleshooting Errors in Application Lifecycle Management Tools.

Managing Layer Validation Errors

During the development process, you might want to suppress some of the reported conflicts in the Error List window during validation. For example, you might want to suppress errors that you are already addressing or that are not relevant to your particular scenario. When you suppress an error, it is a good practice to log a work item in Team Foundation.

To create a work item for a validation error

  • In the Error List window, right-click the error, point to Create Work Item, and then click the type of work item that you want to create.

Use these tasks to manage validation errors in the Error List window:

To

Follow these steps

Suppress selected errors during validation

Right-click the one or multiple selected errors, point to Manage Validation Errors, and then click Suppress Errors.

The suppressed errors appear with strikethrough formatting. When you run validation the next time, these errors will not appear.

Suppressed errors are tracked in a .suppressions file for the corresponding layer diagram file.

Stop suppressing selected errors

Right-click the selected suppressed error or errors, point to Manage Validation Errors, and then click Stop Suppressing Errors.

The selected suppressed errors will appear when you run validation the next time.

Restore all suppressed errors in the Error List window

Right-click anywhere in the Error List window, point to Manage Validation Errors, and then click Show All Suppressed Errors.

Hide all suppressed errors from the Error List window

Right-click anywhere in the Error List window, point to Manage Validation Errors, and then click Hide All Suppressed Errors.

See Also

Concepts

How to: Validate .NET Code Against Layer Diagrams