Open sandboxFocusImprove this doc

LAMA0066: The formatting of generated code is enabled

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:

  • MetalamaFormatOutput is True and the transformed code is written to disk, that is, MetalamaDebugTransformedCode or MetalamaEmitCompilerTransformedFiles is True. Setting MetalamaDebugTransformedCode to True sets MetalamaFormatOutput to True by default, so the warning is expected when you debug the transformed code, for instance in the LamaDebug configuration.
  • MetalamaWriteHtml is True, 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 LAMA0066 to the NoWarn property 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 MetalamaFormatOutput to False explicitly.

See also