Unit test under NativeAOT? #97013
-
This way we can find out and weed out problems for NativeAOT for public projects that have unit tests. I also want to see if I can run NativeAOT without publish mode because some apps have different behavior with regards to Debug/Release mode. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Possibly related to xunit/xunit#2842 ? |
Beta Was this translation helpful? Give feedback.
-
The way to look for problems is by looking for compile-time warnings. Following article shows how to best approach this for libraries: https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/ Looking for AOT/trimming issues at runtime in a unit test is not a good strategy. Unit tests typically exercise the entire library. So even if the library has a trimming issue, just the fact that it was included from a unit test application that references everything in the library may make the issue go away. The issue could still be real, it's just not observable in a test that uses the entire library anyway and makes trimming impossible by definition.
You can publish under debug configuration: |
Beta Was this translation helpful? Give feedback.
The way to look for problems is by looking for compile-time warnings. Following article shows how to best approach this for libraries: https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/
Looking for AOT/trimming issues at runtime in a unit test is not a good strategy. Unit tests typically exercise the entire library. So even if the library has a trimming issue, just the fact that it was included from a unit test application that references everything in the library may make the issue go away. The issue could still be real, it's just not observable in a test that use…