NLog Unit Testing with AOT
Author: snakefootCreated Sep 3, 2026Updated Sep 12, 2026
Labelsunit-testsplatform support
The constant advice from Microsoft is one should not trust .NET code to behave as expected when AOT-build.
Seems unit-frameworks are adding support for testing with AOT:
- https://xunit.net/docs/getting-started/v3/native-aot
- https://tunit.dev/docs/writing-tests/aot/
- https://devblogs.microsoft.com/dotnet/mstest-source-generation/
Currently the NLog-project just verify that an AOT-Test-App doesn't give build-warnings, and can use NLog ConsoleTarget for output.
Source: NLog/NLog