| Severity | Warning |
| Reported by | Metalama.Framework |
| Message | Formatting of generated code is enabled. Build performance could be significantly affected. |
Cause
By default, Metalama doesn't format the code it generates, because formatting takes time and the transformed code is normally not read by anyone. You can ask Metalama to format the transformed code when you want to read it, debug it, or export it.
Metalama reports LAMA0066 at build time when the formatting is enabled, as a reminder that the build is slower than it could be. This happens in the following situations:
MetalamaFormatOutputisTrueand the transformed code is written to disk, that is,MetalamaDebugTransformedCodeorMetalamaEmitCompilerTransformedFilesisTrue. SettingMetalamaDebugTransformedCodetoTruesetsMetalamaFormatOutputtoTrueby default, so the warning is expected when you debug the transformed code, for instance in theLamaDebugconfiguration.MetalamaWriteHtmlisTrue, because the HTML output requires formatted code.
This diagnostic depends on MSBuild properties and isn't reported in aspect tests, so it can't be shown in an example.
Resolution
- If you need the formatted code, for instance in a dedicated debugging configuration, ignore the warning, or suppress it by adding
LAMA0066to theNoWarnproperty in that configuration. - Otherwise, remove the properties listed above from the project, or enable them only in a dedicated build configuration. To keep writing the transformed code to disk without formatting it, set
MetalamaFormatOutputtoFalseexplicitly.