We have discussed the restoration of the Ni file generated by ngen and its enhanced protection method to prevent restoration.
Today I'm testing An ORMProgramIt is found that the Ni file running in enhanced protection mode will appear
Badimageformat exception.
I used an ORM program to test the hvm core. By the way, I also tested the Ni file for enhanced protection mode.
In the previous article, the principles of. Net native image restoration and enhanced protection methods mentioned that the original ilcode can be erased to enhance the protection of Ni files, so that they cannot be restored.
I used this mode to process this ORM program and encountered an exception in badimageformat during data operations.
Then I used the normal mode (without erasing ilcode) to generate a Ni file and run everything normally.
It is estimated that the problem lies in the ORM module, and there is no problem in the operations on the program interface, so the operation on the database is an error.
The specific reason is unclear. The biggest feature of ORM is that reflection is widely used. I wonder if it is caused by reflection?
I have tested some simple programs that use reflection before, and have never encountered such a problem.
It is estimated that the program of AOP will have such a problem...
If you are interested, try it on your own.