| Severity | Error |
| Reported by | Metalama.Framework |
| Message | Cannot find the transitive aspect class '<AspectClass>'. This can happen when a referenced assembly was compiled with a different version of Metalama. Align the version of Metalama used by the current project with the version used to compile the referenced assembly. |
Cause
Some advice has effects that must continue in the projects that reference the current project. For instance, when an aspect introduces a constructor parameter and pulls it from derived types, or adds an initializer that runs after the last instance constructor, the classes derived from the target type in other projects must be transformed too. To achieve this, Metalama stores transitive aspects in the compiled assembly. These are internal aspects of Metalama, not your own aspects. When another project references this assembly, Metalama reads them and applies them to the derived types of the referencing project.
Metalama reports LAMA0072 when it reads a transitive aspect from a referenced assembly but can't find its aspect class, whose name is given by <AspectClass>, in the version of Metalama that compiles the current project. Since these classes belong to Metalama itself, this almost always means that the referenced assembly was compiled with a different version of Metalama, which has a different set of internal aspect classes. Metalama skips the transitive aspect, so the derived types of the current project don't receive the transformations they need.
The diagnostic has no location in your source code.
This diagnostic depends on referenced assemblies compiled with another version of Metalama, so it can't be shown in an example.
Resolution
- Find the referenced assembly that was compiled with another version of Metalama. If it's a project of your solution, the warning LAMA0081 is usually reported too, and gives both versions.
- Use the same version of the Metalama packages in the current project and in the referenced project. If the reference is a NuGet package, update the Metalama packages of the current project to the version used to build the package, or ask the package author for a version built with your version of Metalama.
- Rebuild the solution, so that the referenced projects are compiled again with the aligned version.