No announcement yet.

iOS Solution Template produces exception.

  • Filter
  • Time
  • Show
Clear All
new posts

  • iOS Solution Template produces exception.


    I am just trying to run iOS template in a simulator and I get the following exception:

    "The subtype WaveEngine.ImageEffects.AntialiasingLens can not be found in the schema."

    ​​​​​​" at WaveEngine.Common.Serialization.ProtobufModelBuild er.BuildFromSchema (System.IO.Stream schemaStream) [0x00115] in <94363b30659544419ee9af28f1cfd359>:0 \n at WaveEngine.Common.Serialization.SerializerProtobuf .BuildRuntimeModel (WaveEngine.Common.IO.IIOManager ioManager) [0x0002b] in <94363b30659544419ee9af28f1cfd359>:0 \n at WaveEngine.Common.Serialization.SerializerProtobuf +<>c__DisplayClass9_0.<GetSerializer>b__0 () [0x00000] in <94363b30659544419ee9af28f1cfd359>:0 \n at System.Lazy`1[T].CreateValue () [0x00075] in /Library/Frameworks/Xamarin.iOS.framework/Versions/ "

    Kind regards,

  • #2
    Hi barje23.

    Have you included the WaveEngine.ImageEffect reference in your project? It should be by default. Otherwise you can add that NugetPackage (via Manage Nuget Packages... in your VS project))


    • #3

      It is a fresh solution created in Wave Editor on Mac for iOS and Mac Platforms. Mac Platform runs fine in the Wave Editor, however when I open iOS solution in Xamarin Studio - this problem appears as a runtime error in the MainController's Update method override, shortly after the WaveEngine splash screen is shown on my iPhone simulator's screen.

      I have checked - WaveEngine.ImageEffects.dll is there in "/.../packages/WaveEngine.ImageEffects." folder.



      • #4
        Hi bartek23, I tried to reproduce the error you described but I was unable.
        I will have a look on Tuesday to see if I can discover whats is going on with Wave Editor in OSX


        • #5
          I'm getting this error too. VS2017 + Mac
          When I check the content of bin/IphoneSimulator/Debug/device-builds/iphonexxx/ I can't see the WaveEngin.ImageEffects.dll file there, but rest of other referenced WaveEngine dll files are there.


          • #6

            Hi ashemez,

            The issue is caused because the iOS compiler removes the unused dlls. To avoid it you must remove the reference (if you are no using it in your project) or add some code that uses any class of ImageEffect.

            For example you can add the method Preserve in the file "Program.cs", even if the method is not used.

                public class Program
                    static void Main(string[] args)
                        UIApplication.Main(args, null, "AppDelegate");
                    void Preserve()
                        var a = new WaveEngine.ImageEffects.InvertLens();


            • #7
              Thanks Daniel, I'll try it. But why should it assume it is unused, because the error is thrown where WaveEngine's Load method of Scene. So I guess default Load method or somewhere in the trace engine uses this class.


              • #8
                Hello Daniel,

                Yes this worked. I also found another IncludeAssemblies() method in MainController.cs which is used for this issue too.
                I add the required classes here like this: var a1 = typeof(WaveEngine.ImageEffects.AntialiasingLens);



                • #9

                  Hi ashemez,

                  Yes, there are a method for preserve assemblies already, I forgot it.

                  The issue is caused because the exporter used for the scenes and prefabs in the build process creates a list of types based in the referenced assemblies and when Xamarin builds the project remove the assemblies that is not used in code.
                  This list of types helps in runtime to generates the serialization model faster, but when the serializer is used for the first time and a type cannot be found, the exception is thrown.
                  In the next release, we will fix it.



                  • #10
                    IncludeAssemblies() is a private static method of the controller, where should I call it ?


                    • #11

                      When building your Game for iOS, the compiler calls a tool called mtouch that includes a linker for managed code.
                      To avoid linker remove necessary libraries you must add some code that uses any class of ImageEffect. That's why we added the code IncludeAssemblies.
                      Just add the label Preserve and call it.

                      HTML Code:
                      private static void IncludeAssemblies()
                           // Include WaveEngine Components
                           var a1 = typeof(WaveEngine.Components.Cameras.FreeCamera3D);
                      My recommendation is to create a Linker configuration file. I hope it helps.



                      • #12
                        Hi, I have another issue of this type, it happens always in Release Configuration builds of a clean WaveEngine iOS template, Debug mode never fails like this on a device, and I cannot get rid of it by adding some code that uses the TextComponent class.

                        Please see below: The subtype WaveEngine.Components.Toolkit.TextComponent can not be found in the schema.

                        • 1
                          ProtobufModelBuilder.BuildFromSchema (System.IO.Stream schemaStream)
                        • 2
                          SerializerProtobuf.BuildRuntimeModel (WaveEngine.Common.IO.IIOManager ioManager)
                        • 3
                          SerializerProtobuf+<>c__DisplayClass9_0.<GetSerial izer>b__0 ()
                        • 4
                          Lazy`1[T].CreateValue ()
                        • 5
                          Lazy`1[T].LazyInitValue ()
                        • 6
                          Lazy`1[T].get_Value ()
                        • 7
                          WaveEngine.Common.Serialization.SerializerProtobuf ..ctor (System.Type type) <0x1007334a0 + 0x00063> in <94363b30659544419ee9af28f1cfd359#064b8d02156c6098 1903399752ec5516>:0
                        • 8
                          SerializerProtobuf.GetSerializer (System.Type type, WaveEngine.Common.IO.IIOManager ioManager)
                        • 9
                          SerializerFactory.GetSerializer (System.Type type, WaveEngine.Framework.SerializationType serializationType)
                        • 10
                          SerializerFactory.GetSerializer (System.Type type)
                        • 11
                          SerializerFactory.GetSerializer[T] ()
                        • 12
                          AssetsContainer.LoadNewModel[T] (System.String name)
                        • 13
                          AssetsContainer.LoadModel[T] (System.String name, System.Boolean sharedInstance)
                        • 14
                          Scene.Load (System.String path)
                        • 15
                          MyScene.CreateScene ()
                        • 16
                          Scene.Initialize (WaveEngine.Framework.Services.GraphicsDevice graphicsDevice)
                        • 17
                          ScreenContextManager.InitializeASingleScene (WaveEngine.Framework.Scene scene)
                        • 18
                          ScreenContextManager.InitializeScreenContext (WaveEngine.Framework.Services.ScreenContext context)
                        • 19
                          ScreenContextManager.ToExecute (WaveEngine.Framework.Services.ScreenContext nextContext, WaveEngine.Framework.Services.ScreenTransition transition, System.Boolean doDispose)
                        • 20
                          ToContextCommand.Execute ()
                        • 21
                          ScreenContextManager.Update (System.TimeSpan gameTime)
                        • 22
                          Game.UpdateFrame (System.TimeSpan gameTime)
                        • 23
                          MainController.Update (System.TimeSpan elapsedTime)
                        • 24
                          GLView.OnUpdateFrame (OpenTK.FrameEventArgs e)
                        • 25
                          GLView.DrawFrame ()
                        • 26
                          (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
                        • 27
                          UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
                        • 28
                          UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
                        • 29
                          Program.Main (System.String[] args)
                        I have also noticed multiple (102) warnings like below in the test project:

                        Native linking warning: warning: object file (/Users/USER/Library/Caches/Xamarin/mtbs/builds/iosTest/6c4b1497ee264b44e5480867d4289670/obj/iPhone/Ad-Hoc/mtouch-cache/MobileCenterCrashes.a(MSException.o)) was built for newer iOS version (8.0) than being linked (6.0)


                        • #13

                          The only way I can make the Release build working on a device is to explicitly set Optimize tag in .csproj to FALSE, as it is pre-set for Debug mode:
                          Thnks, Bartek.
                          Optimize tag False for Release.PNG


                          • #14

                            Now, this are the options to use (disable code optimization or create a Linker configuration file). We are testing and evaluating options to change the iOS template and include a Linker configuration file that allows everything to work as expected in Release. I'll let you know when it's available.



                            • #15
                              I still have problems running a fresh template of an iOS app in the Release mode, Debug mode works fine. I have caught the following exception as per version of WaveEngine:

                               runtime.m - line 1206  SIGABRT  MAIN THREAD - CRASHED
                              • 0 libsystem_kernel.dylib __pthread_kill
                              • 1 libsystem_c.dylib abort
                              • 2 ReleaseTest log_callback(char const*, char const*, char const*, int, void*)¬†runtime.m:1206
                              • 3 ReleaseTest monoeg_g_log¬†goutput.c:115
                              • 4 ReleaseTest load_aot_module¬†aot-runtime.c:2028
                              • 5 ReleaseTest mono_assembly_load_from_predicate¬†assembly.c:1476
                              • 6 ReleaseTest mono_assembly_open_predicate¬†assembly.c:1973
                              • 7 ReleaseTest assembly_preload_hook(_MonoAssemblyName*, char**, void*)¬†monotouch-main.m:137
                              • 8 ReleaseTest mono_assembly_load_full_nosearch¬†assembly.c:1644
                              • 9 ReleaseTest ves_icall_System_AppDomain_LoadAssembly¬†appdomain.c:2233
                              • 10 ReleaseTest wrapper_managed_to_native_System_AppDomain_LoadAssembly_System_AppDomain_string_System_Security_Policy_Evidence_bool
                              • 11 ReleaseTest System_AppDomain_Load_System_Reflection_AssemblyName_System_Security_Policy_Evidence
                              • 12 ReleaseTest System_AppDomain_Load_System_Reflection_AssemblyName
                              • 13 ReleaseTest System_Reflection_Assembly_Load_System_Reflection_AssemblyName
                              • 14 ReleaseTest WaveEngine_Common_Serialization_SerializationUtils_AddWaveAssembly_System_Collections_Generic_Dictionary_2_string_System_Reflection_Assembly_string<unknown>:1
                              • 15 ReleaseTest WaveEngine_Common_Serialization_SerializationUtils_AddWaveAssemblies_System_Collections_Generic_Dictionary_2_string_System_Reflection_Assembly_WaveEngine_Common_Attributes_WaveAssemblyUsage<unknown>:1
                              • 16 ReleaseTest WaveEngine_Common_Serialization_SerializationUtils_GetAssemblyList_WaveEngine_Common_Attributes_WaveAssemblyUsage¬†<unknown>:1
                              • 17 ReleaseTest WaveEngine_Common_Serialization_SerializationUtils_GetWaveEngineTypes_bool¬†<unknown>:1
                              • 18 ReleaseTest WaveEngine_Common_Serialization_SerializerProtobuf_BuildRuntimeModel_WaveEngine_Common_IO_IIOManager¬†<unknown>:1
                              • 19 ReleaseTest WaveEngine_Common_Serialization_SerializerProtobuf__c__DisplayClass9_0__GetSerializerb__0¬†<unknown>:1
                              • 20 ReleaseTest System_Lazy_1_T_REF_CreateValue
                              • 21 ReleaseTest System_Lazy_1_T_REF_LazyInitValue
                              • 22 ReleaseTest System_Lazy_1_T_REF_get_Value
                              • 23 ReleaseTest WaveEngine_Common_Serialization_SerializerProtobuf__ctor_System_Type¬†<unknown>:1
                              • 24 ReleaseTest WaveEngine_Common_Serialization_SerializerProtobuf_GetSerializer_System_Type_WaveEngine_Common_IO_IIOManager¬†<unknown>:1
                              • 25 ReleaseTest WaveEngine_Framework_SerializerFactory_GetSerializer_System_Type_WaveEngine_Framework_SerializationType¬†<unknown>:1
                              • 26 ReleaseTest WaveEngine_Framework_SerializerFactory_GetSerializer_System_Type¬†<unknown>:1
                              • 27 ReleaseTest WaveEngine_Framework_SerializerFactory_GetSerializer_T_REF¬†<unknown>:1
                              • 28 ReleaseTest WaveEngine_Framework_Game_Load_string¬†<unknown>:1
                              • 29 ReleaseTest ReleaseTest_Game_Initialize_WaveEngine_Common_IApplication¬†<unknown>:1
                              • 30 ReleaseTest ReleaseTest_MainController_Initialize¬†<unknown>:1
                              • 31 ReleaseTest WaveEngine_Adapter_GLView_OnUpdateFrame_OpenTK_FrameEventArgs¬†<unknown>:1
                              • 32 ReleaseTest WaveEngine_Adapter_GLView_DrawFrame¬†<unknown>:1
                              • 33 ReleaseTest wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
                              • 34 ReleaseTest mono_jit_runtime_invoke¬†mini-runtime.c:2776
                              • 35 ReleaseTest do_runtime_invoke¬†object.c:2849
                              • 36 ReleaseTest mono_runtime_invoke¬†object.c:3002
                              • 37 ReleaseTest native_to_managed_trampoline_7(objc_object*, objc_selector*, _MonoMethod**, unsigned int)¬†registrar.m:283
                              • 38 ReleaseTest -[GLView¬†drawFrame]¬†registrar.m:2525
                              • 39 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
                              • 40 IOKit IODispatchCalloutFromCFMessage
                              • 41 CoreFoundation __CFMachPortPerform
                              • 42 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
                              • 43 CoreFoundation __CFRunLoopDoSource1
                              • 44 CoreFoundation __CFRunLoopRun
                              • 45 CoreFoundation CFRunLoopRunSpecific
                              • 46 GraphicsServices GSEventRunModal
                              • 47 UIKit UIApplicationMain
                              • 48 ReleaseTest wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr¬†<unknown>:1
                              • 49 ReleaseTest UIApplication.cs:79
                              • 50 ReleaseTest UIApplication.cs:63
                              • 51 ReleaseTest ReleaseTest_Program_Main_string__¬†<unknown>:1
                              • 52 ReleaseTest wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
                              • 53 ReleaseTest mono_jit_runtime_invoke¬†mini-runtime.c:2776
                              • 54 ReleaseTest do_runtime_invoke¬†object.c:2849
                              • 55 ReleaseTest do_exec_main_checked¬†object.c:3002
                              • 56 ReleaseTest mono_jit_exec¬†driver.g.c:1040
                              • 57 ReleaseTest xamarin_main¬†monotouch-main.m:483
                              • 58 ReleaseTest main¬†main.m:87
                              • 59 libdyld.dylib start