Open sandboxFocusImprove this doc

LAMA0235: A template uses a type or member that refers to an unresolved type

Severity Error
Reported by Metalama.Framework
Message The type or member '<Symbol>' refers to a type that cannot be resolved. Fix this error first, otherwise Metalama may report irrelevant errors in the current template.

Cause

To compile a T# template, Metalama resolves every type and member that the template references, and classifies each of them as compile-time or run-time. When a referenced declaration involves a type that the C# compiler can't resolve, Metalama can't classify the code correctly.

Metalama reports LAMA0235 when a template references a type or member, given by the placeholder, that refers to an unresolved type in one of the following places:

  • a type argument of a generic type, for instance List<Missing>;
  • the return type or a parameter type of a method;
  • the type or a parameter type of a property or indexer;
  • the type of a field or event.

The unresolved type itself is reported by the C# compiler, typically with CS0246 or CS0234, on the declaration that uses it. A reference to a type that's completely unresolved isn't reported as LAMA0235, because the C# error is enough.

This diagnostic occurs only in code that the C# compiler rejects, so it can't be shown in an example.

Resolution

Fix the C# errors on the declaration given in the message, then rebuild. Typical causes are:

  • a misspelled type name or a missing using directive;
  • a missing project or package reference;
  • a type that's defined only under a preprocessor symbol that isn't defined in the current build.

Once the referenced declaration is valid, LAMA0235 disappears, and so do any other errors that Metalama reported in the template because of it.

See also