I am working on Xamarin.Forms project. I have a xUnit test project targeting dotnet 5. The xunit NuGet version is 2.4.1. When I run the tests I get the error mentioned in the title and all tests fail. The complete test detail summary is as follows:
Message:
System.TypeInitializationException : The type initializer for'<Module>'
threw an exception.
---- System.InvalidProgramException : The JIT compiler encountered invalid IL code or an internal limitation.Stack Trace:
LoginTest.ctor()
----- Inner Stack Trace -----
cctor()
This only happens when there is Realm Database used in the app. If I Remove Realm Models along with all the realm related code the test runs and pass successfully. Here is the link to sample project.