Today in the write cocos2d-x program, found this problem, press the START key to enter the background, or press the return key to return to the program. This exception is thrown. The thread is interrupted and the program cannot be returned.
The exception information is as follows:
The first accidental "System. Runtime. Serialization. dll" exception in System. Security. SecurityException
The first "mscorlib. dll" exception that occurs occasionally in System. Reflection. TargetInvocationException
The first accidental "System. Runtime. Serialization. dll" exception in System. Security. SecurityException
Thread '<No Name>' (0xec30092) has exited, and the returned value is 0 (0x0 ).
Thread '<No Name>' (0xe9d009a) has exited, and the returned value is 0 (0x0 ).
Thread '<No Name>' (0xfbf0072) exited. The returned value is 0 (0x0)
This is quite confusing. Suddenly, after the program enters the background, it cannot return.
After a great deal of effort, I finally figured out what caused the problem. It is because I saved a scenario reference in PhoneApplicationService, which is quite violent. Microsoft thinks it is insecure. This security exception is thrown ..
How can this problem be solved? Only the scenario saved by PhoneApplicationService on Deactivate is removed. However, I still need this value. I can only save it to IsolatedStorageSettings before removing it, And then retrieve the value from Actived and save it to PhoneApplicationService.
However, the same exception still exists. Because the IsolatedStorageSettings still does not meet the security requirements... But it can still achieve the goal .. The program can enter the background and return. What about other security ....