Can Metalama suppress compiler errors?

Hello! I want to know if I can use Metalama in my library. The users of my library have to declare the next class with this inheritance: public class EmailAlreadyExists(string email) : BusinessException("{0} already exists") So, with Metalama I can replace the parameter email in the message with the placeholder. For example, with: ... : BusinessException(string.Format("{0} already exists", email)) But most of developers will have <TreatWarningsAsErrors>true</TreatWarningsAsErrors>, so they'll get compiler errors because they don't use the parameter email, even if it's used with Metalama. Is this correct? Originally my intention was to use source generators, but I don't want to plague all their code with partial.
1 Reply
Petr Onderka
Petr Onderka17mo ago
Yes, Metalama can do that. It's documented in https://doc.metalama.net/conceptual/aspects/diagnostics, section "Suppressing a diagnostic".
Want results from more Discord servers?
Add your server