Merge pull request #7784 from Teivaz/v3

Fixed WP8 compilation errors
[ci skip]
fix android background and foreground crash for primitive
Merge pull request #7793 from dabingnn/v3_fixRandomCrashForPrimitive

fix android background and foreground crash for primitive