| Severity | Error |
| Reported by | Metalama.Framework |
| Message | The run-time identifier '<Identifier>' was not declared in the template. This can be caused by an error in the template or by a defect in Metalama. |
Cause
When Metalama compiles a T# template, it renames the run-time local variables, local functions, and lambda parameters of the template so that they don't conflict with the names in the target code. To do that, it records every local declaration it meets in the template.
Metalama reports LAMA0109 when the template references such a local symbol, named by the placeholder of the message, but the template compiler hasn't recorded its declaration. This doesn't happen with valid C# code: it can only occur when the compilation contains errors or because of a defect in Metalama. For this reason, this article has no example.
Resolution
- Fix any C# compilation errors in the aspect project first, then rebuild.
- If the code compiles without errors, the diagnostic is caused by a defect in Metalama. Rewrite the construct that declares the identifier, for example by declaring the variable in a separate statement, and report the issue to the Metalama team with the code of the template.