RegisterMonoModules.cpp compile error after upgrade to 4.6.8

Have just upgraded to 4.6.8 and done a fresh build of my project and somehow an extra #endif has been inserted into RegisterMonoModules.cpp.

Also tried a blank project and couldn’t repeat the problem.

This file is generated by the build process right? So how is it happening?

Obviously I can just edit by hand but I’d prefer a proper fix.

void RegisterMonoModules()
{
#if !(TARGET_IPHONE_SIMULATOR)
    mono_aot_only = true;
    mono_ficall_flag = false;
    mono_aot_register_module(mono_aot_module_Assembly_CSharp_firstpass_info);
    mono_aot_register_module(mono_aot_module_Assembly_CSharp_info);
    mono_aot_register_module(mono_aot_module_DOTween_info);
    mono_aot_register_module(mono_aot_module_DOTween43_info);
    mono_aot_register_module(mono_aot_module_DOTween46_info);
    mono_aot_register_module(mono_aot_module_IFacebook_info);
    mono_aot_register_module(mono_aot_module_Mono_Security_info);
    mono_aot_register_module(mono_aot_module_P31RestKit_info);
    mono_aot_register_module(mono_aot_module_Parse_Unity_info);
    mono_aot_register_module(mono_aot_module_SampleClassLibrary_info);
    mono_aot_register_module(mono_aot_module_System_Core_info);
    mono_aot_register_module(mono_aot_module_System_Xml_info);
    mono_aot_register_module(mono_aot_module_System_info);
    mono_aot_register_module(mono_aot_module_UnityEngine_UI_info);
    mono_aot_register_module(mono_aot_module_UnityEngine_info);
    mono_aot_register_module(mono_aot_module_mscorlib_info);
#endif // !(TARGET_IPHONE_SIMULATOR)
#endif // !(TARGET_IPHONE_SIMULATOR)

Oh no, this is going to get very annoying - an Append build must regenerate RegisterMonoModules.cpp and the extra #endif is reintroduced every build.

Has anyone else seen this?

Im using 4.6.8p1 no issues so far…
But i did not do simulator build

It appears to be caused by the inclusion of the Facebook Unity SDK.

I reported a bug, here’s their reply.

“Since this only affects Unity v4, we are closing this as a Won’t Fix. As a workaround, you can remove the code from Facebook/Editor/iOS/FixupFiles.cs. This code is not executed in Unity v5 with our SDK 7.x.”

It occurs on non-simulator builds.