I am using compiled expressions to create instance. It is very fast in JIT but not in AOT (even slower) because of the fallback process. So I want to check whether the code is running in AOT. If yes, I will use ConstructorInfo.Invoke
instead.
ATM, I only have an idea to check this by calling one of the methods are not allowed in AOT and then catch the error. Does any other better ways to check?