Diagnostics about T# templates: compile-time and run-time scopes, unsupported C# constructs, and template parameters.
| Article | Description |
|---|---|
| LAMA0101: The C# language feature isn't supported in a template | A template uses a C# language feature that T# doesn't support. |
| LAMA0104: The expression has the wrong scope | A template expression is run-time where Metalama expects compile-time, or the opposite. |
| LAMA0105: A declaration can't mix compile-time and run-time local variables | A local variable declaration in a template mixes compile-time and run-time variables. |
| LAMA0108: A compile-time variable can't be set under a run-time condition | A template sets a compile-time variable declared outside a block that depends on a run-time condition. |
| LAMA0109: A run-time identifier in a template wasn't declared | The template compiler can't find the declaration of a local symbol used in a template. |
| LAMA0110: A compile-time loop can't be used under a run-time condition | A template has a compile-time while or do loop in a block that depends on a run-time condition. |
| LAMA0113: An aspect type of a referenced assembly can't be found | An aspect type of a referenced assembly can't be found in the current compilation. |
| LAMA0114: A template can't reference this in a static member | A template references the current instance, but the advice is applied to a static member. |
| LAMA0115: A meta.Target member isn't available for the current target | A template uses a meta.Target member that doesn't apply to the declaration the advice is applied to. |
| LAMA0117: Code that isn't compile-time references a compile-time-only declaration | Code that isn't compile-time references a compile-time-only declaration. |
| LAMA0118: The compile-time code changed since the last build | Compile-time code was modified, and Metalama paused design-time analysis until the next build. |
| LAMA0119: A file with compile-time code must import a Metalama namespace | A file that contains compile-time code doesn't import a Metalama.Framework namespace. |
| LAMA0220: A template can only call template methods | A template references another template that isn't a method. |
| LAMA0221: The this keyword can't be used as a run-time expression | A template uses the this keyword where a run-time expression is expected. |
| LAMA0222: The compile-time project can't be compiled | The compile-time project, made of the aspects and other compile-time code, can't be compiled. |
| LAMA0223: The Proceed variant doesn't match the return type of the method | A template calls a Proceed variant that doesn't match the return type of the target method. |
| LAMA0224: A dynamic local variable must be initialized | A template declares a dynamic local variable without initializing it. |
| LAMA0225: A dynamic local variable can't be initialized with null or default | A template initializes a dynamic local variable with null, default, or another target-typed expression. |
| LAMA0226: A construct can't combine run-time and compile-time elements | A type, member, or expression combines run-time-only and compile-time-only elements. |
| LAMA0227: dynamic can't be used to build another type in a template | A template uses dynamic as a generic argument, an array element type, a tuple element type, or a ref type. |
| LAMA0229: A run-time-or-compile-time type can't be nested in a run-time class | A type that is both run-time and compile-time, such as an aspect, is nested in a run-time class. |
| LAMA0230: A compile-time class nested in a run-time type must be private | A compile-time class nested in a run-time type, such as a type fabric, isn't private. |
| LAMA0231: Only type fabrics can be nested in a run-time type | A compile-time type other than a type fabric is nested in a run-time type. |
| LAMA0232: A template uses a C# feature that's too recent | A template uses a C# feature that's newer than the C# version allowed in templates. |
| LAMA0233: A template-only API is used outside of a template | Compile-time code that isn't a template uses an API that's only allowed inside templates. |
| LAMA0235: A template uses a type or member that refers to an unresolved type | A template uses a type or member whose signature refers to a type that can't be resolved. |
| LAMA0236: Compile-time code references a run-time-only declaration | Code that can execute at compile time references a run-time-only declaration. |
| LAMA0237: An abstract template property can't have a run-time-only type | An abstract template property has a run-time-only type. |
| LAMA0238: Only templates can use the dynamic type in compile-time code | A member that isn't a template uses the dynamic type in a type that isn't run-time-only. |
| LAMA0241: An expression mixes compile-time and run-time sub-expressions | An expression in a template combines a compile-time sub-expression with a run-time sub-expression. |
| LAMA0242: The type of an expression conflicts with the scope of its sub-expression | In a template, the type of an expression requires a different execution scope than its sub-expressions. |
| LAMA0244: The type and its base type have incompatible scopes | A type has a base type or interface whose execution scope is incompatible with its own. |
| LAMA0245: A symbol combines run-time and compile-time elements | A symbol combines run-time and compile-time elements in a way Metalama can't explain in detail. |
| LAMA0246: A local function in a template can't use dynamic in its signature | A local function in a template uses dynamic in its signature. |
| LAMA0247: A template returns a void result where a value is expected | A template returns a void expression where a value of another type is expected. |
| LAMA0248: Compile-time code can't be unsafe | A compile-time declaration, such as an aspect class or a fabric, is marked as unsafe. |
| LAMA0249: A template can't be unsafe | A template member is marked as unsafe. |
| LAMA0250: This use of dynamic isn't allowed in a template | A template uses dynamic in a cast, an is, as, or default expression, a lambda signature, or a method type argument. |
| LAMA0251: A dynamic variable must be initialized with a dynamic expression | A template initializes a dynamic local variable with an expression that isn't dynamic. |
| LAMA0252: A template can't be partial | A template method, property, or indexer is declared as partial. |
| LAMA0253: A compile-time-only value can't be passed to a run-time method | A template passes a value of a compile-time-only type to a run-time method. |
| LAMA0254: The argument of ConfigureAwait after ProceedAsync must be a literal | The argument of ConfigureAwait after meta.ProceedAsync() isn't the literal true or false. |
| LAMA0255: A run-time expression can't be cast to a compile-time type | A template casts a run-time expression to a compile-time-only type. |
| LAMA0256: The dynamic argument must be cast to IExpression | A dynamic expression is passed to a compile-time method without an explicit cast to IExpression. |
| LAMA0257: A template member can't be set from an attribute | An aspect custom attribute sets a member of the aspect that is a template. |
| LAMA0258: The declaration can't be a template | A finalizer, operator, conversion operator, or constructor is marked as a template. |
| LAMA0259: The null-conditional operator mixes compile-time and run-time parts | The null-conditional operator mixes a compile-time receiver with a run-time member in a template. |
| LAMA0260: A type fabric can't be nested in a compile-time type | A type fabric is nested in a compile-time or run-time-or-compile-time type. |
| LAMA0261: A declaration can have only one template or advice attribute | A member has more than one template or advice attribute, such as both [Introduce] and [Template]. |
| LAMA0262: Template or advice attributes can't be applied to an accessor | A template or advice attribute is applied to an accessor instead of its property or event. |
| LAMA0263: A lambda in a template can't return a dynamic expression | A lambda in a template has an expression body of type dynamic. |
| LAMA0264: A compile-time template parameter can't have a run-time-only type | A compile-time template parameter has a type that exists only at run time. |
| LAMA0265: Static interface members can't be accessed on a compile-time type parameter | A template accesses a static interface member through a compile-time type parameter. |
| LAMA0267: A template can't convert an extension method group to a delegate | A template converts an extension method to a delegate with a method group conversion. |
| LAMA0268: A template member can't be resolved | Metalama can't resolve a template member, typically because of conflicting assembly references. |
| LAMA0269: An anonymous type is used in both run-time and compile-time code | The same anonymous type is used in both run-time and compile-time code of a template. |
| LAMA0270: A template can only be called as a stand-alone statement | A template calls an auxiliary template inside an expression instead of as a stand-alone statement. |
| LAMA0271: A template can't be an extension method | A template method is declared as a C# extension method. |
| LAMA0272: A void template contains a redundant return statement | A void template contains a return statement that isn't needed. |
| LAMA0273: A template can only be referenced in a direct call | A template references another template without calling it directly. |
| LAMA0274: A template must be declared in an aspect, a fabric, or a template provider | A template is declared in a type that isn't an aspect, a fabric, or a template provider. |
| LAMA0275: A call to a virtual template can't omit optional arguments | A call to a virtual auxiliary template omits arguments of optional parameters. |
| LAMA0276: A called template can't have run-time type parameters | A generic auxiliary template called from another template has a run-time type parameter. |
| LAMA0277: A called template can't receive a run-time type parameter as type argument | A template passes a run-time type parameter as the type argument of a called template. |
| LAMA0278: An aspect can't be a struct | An aspect is declared as a struct instead of a class. |
| LAMA0279: An abstract or empty template can't be called | A template calls an auxiliary template that's abstract or empty. |
| LAMA0280: A compile-time expression can't be set under a run-time condition | A template sets a compile-time expression, such as a property of a compile-time object, in a block that depends on a run-time condition. |
| LAMA0281: An attribute isn't allowed on compile-time code | An attribute that wouldn't have the expected effect is applied to a compile-time declaration. |
| LAMA0282: The aspect uses a newer C# version than the project | An aspect's template uses C# features that are newer than the C# version of the project where it's used. |
| LAMA0283: Compile-time types can't have a primary constructor | A compile-time class or struct declares a primary constructor. |
| LAMA0284: The scope of a lambda or anonymous method can't be determined | The scope of an anonymous method or of a lambda with a block body in a template can't be determined. |
| LAMA0285: A local function in a template can't have a template or scope attribute | A local function declared in a template has a template or scope attribute. |
| LAMA0286: A non-dynamic run-time expression can't be cast to IExpression | A template casts a run-time expression that isn't dynamic to IExpression. |
| LAMA0287: A template can't get the receiver of a member that has none | A template uses the receiver of the target member, but the member has no receiver. |
| LAMA0288: A compile-time call with side effects can't depend on a run-time condition | A compile-time statement with side effects is in a block that depends on a run-time condition. |
| LAMA0289: The null-conditional operator can't cross from compile-time to run-time code | A template uses the ?. operator on a compile-time expression to access a run-time value. |
| LAMA0290: Two versions of an aspect library provide the same aspect type | Two versions of the same aspect library provide the same aspect type. |
| LAMA0291: Code that isn't compile-time references a Roslyn type | Code that isn't compile-time references a Roslyn type, which is compile-time-only in the project. |
| LAMA0292: The scope of a member doesn't match the scope of its type | The scope of a member isn't compatible with the scope of its declaring type. |
| LAMA0293: A template with a try-catch block can't override an async iterator | A template that wraps meta.Proceed() in a try-catch block can't override an async iterator method. |
| LAMA0294: A C# feature isn't supported in compile-time code | Compile-time code uses a C# feature, such as inline arrays, that .NET Standard 2.0 doesn't support. |
| LAMA0295: The declaration of a declarative advice can't be resolved | Metalama can't find the declaration of a declarative advice member of an aspect, so the advice is ignored. |
| LAMA0297: An inspection-only expression can't be used in generated code | An expression marked as inspection-only is used in generated code. |