Open
Description
As of today whenever we want to call user's attention to some aspect of the generated code we have two alternatives
- emit a comment in the generated code: far from ideal, users may simply overlook it.
- throw an exception: Ugly, prevents user from seeing any generated code; may mislead users to think they found bugs
We intend to add a mechanism to allow Cecilifier to emit warnings/errors
in a way that will be harder to overlook them.
API
internal interface IVisitorContext
{
// ...
void EmitWarning(string message);
void EmitError(string message);
}
Bebavior
Invoking these members will:
- Show the
message
in the frontend (as a notification, similar to the notifications used to report compilation errors) - Add a
#warning message
/#error message
directive in the generated code so if user overlooks 1 they have another chance notice the warning in the code and if they don't and try to compile they will get a compilation warning/error.
Known use cases
The main driver for this feature is to report unsupported C# features
but most likely there are other use cases.
Activity