Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netMQ 3.5 vs Unity WebGL il2cpp error #613

Closed
Borisss opened this issue Sep 13, 2016 · 8 comments
Closed

netMQ 3.5 vs Unity WebGL il2cpp error #613

Borisss opened this issue Sep 13, 2016 · 8 comments
Labels

Comments

@Borisss
Copy link

Borisss commented Sep 13, 2016

Environment

NetMQ Version:    built from 3.5 sln
Operating System: win7
.NET Version:     3.5

Steps to reproduce

when trying to switch to WebGL and build (Unity 5.3.4f), there is a mysterious il2cpp error:

Failed running C:\Program Files\Unity\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --copy-level=None --enable-symbol-loading --development-mode --extra-types.file="C:\Program Files\Unity\Editor\Data\il2cpp\il2cpp_default_extra_types.txt" --assembly="W:\Borisss\Mercedes\Temp\StagingArea\Data\Managed\Assembly-CSharp-firstpass.dll" --assembly="W:\Borisss\Mercedes\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" --assembly="W:\Borisss\Mercedes\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll" --assembly="W:\Borisss\Mercedes\Temp\StagingArea\Data\Managed\UnityEngine.dll" --generatedcppdir="W:\Borisss\Mercedes\Temp\StagingArea\Data\il2cppOutput"

stdout:
IL2CPP error for method 'System.Void NetMQ.Core.Transports.Pgm.PgmSender::StartConnecting()' in assembly 'W:\Borisss\Mercedes\Temp\StagingArea\Data\Managed\NetMQ.dll'
Additional information: Build a development build for more information. The method or operation is not implemented.
il2cpp.exe didn't catch exception: System.NotImplementedException: The method or operation is not implemented.
at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData(ExceptionHandlerData data, ExceptionHandler handler)
at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData(Dictionary2 datas, ExceptionHandler handler) at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData() at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.CreateGraph() at Unity.IL2CPP.Common.CFG.ControlFlowGraph.Create(MethodDefinition method) at Unity.IL2CPP.MethodBodyWriter..ctor(CppCodeWriter writer, MethodReference methodReference, TypeResolver typeResolver, IRuntimeMetadataAccess metadataAccess, VTableBuilder vTableBuilder, MethodBodyWriterDebugOptions options) at Unity.IL2CPP.MethodWriter.WriteMethodBody(MethodReference method, CppCodeWriter methodBodyWriter, IRuntimeMetadataAccess metadataAccess) at Unity.IL2CPP.MethodWriter.WriteMethodWithMetadataInitialization(CppCodeWriter writer, String methodSignature, Action3 writeMethodBody, String uniqueIdentifier)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinition(MethodReference method, IMethodCollector methodCollector)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinitions(Func2 filter, IMethodCollector methodCollector) at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, String fileName, IEnumerable1 typeList, IMethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.SourceWriter.Write(AssemblyDefinition assemblyDefinition, InflatedCollectionCollector allGenerics, NPath outputDir, TypeDefinition[] typeList, AttributeCollection attributeCollection, MethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.AssemblyConverter.Convert(AssemblyDefinition assemblyDefinition, InflatedCollectionCollector allGenerics, AttributeCollection attributeCollection, MethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.AssemblyConverter.Apply()
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(String[] assemblies, NPath outputDir)
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 explicitAssemblies, NPath outputDir)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
stderr:

Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData(ExceptionHandlerData data, ExceptionHandler handler)
at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData(Dictionary2 datas, ExceptionHandler handler) at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.ComputeExceptionHandlerData() at Unity.IL2CPP.Common.CFG.ControlFlowGraphBuilder.CreateGraph() at Unity.IL2CPP.Common.CFG.ControlFlowGraph.Create(MethodDefinition method) at Unity.IL2CPP.MethodBodyWriter..ctor(CppCodeWriter writer, MethodReference methodReference, TypeResolver typeResolver, IRuntimeMetadataAccess metadataAccess, VTableBuilder vTableBuilder, MethodBodyWriterDebugOptions options) at Unity.IL2CPP.MethodWriter.WriteMethodBody(MethodReference method, CppCodeWriter methodBodyWriter, IRuntimeMetadataAccess metadataAccess) at Unity.IL2CPP.MethodWriter.WriteMethodWithMetadataInitialization(CppCodeWriter writer, String methodSignature, Action3 writeMethodBody, String uniqueIdentifier)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinition(MethodReference method, IMethodCollector methodCollector)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinitions(Func2 filter, IMethodCollector methodCollector) at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, String fileName, IEnumerable1 typeList, IMethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.SourceWriter.Write(AssemblyDefinition assemblyDefinition, InflatedCollectionCollector allGenerics, NPath outputDir, TypeDefinition[] typeList, AttributeCollection attributeCollection, MethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.AssemblyConverter.Convert(AssemblyDefinition assemblyDefinition, InflatedCollectionCollector allGenerics, AttributeCollection attributeCollection, MethodCollector methodCollector, IMetadataCollection metadataCollection)
at Unity.IL2CPP.AssemblyConverter.Apply()
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(String[] assemblies, NPath outputDir)
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 explicitAssemblies, NPath outputDir)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:94)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection1, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:328) UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:203) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:135)
UnityEditor.HostView:OnGUI()

it doesn't make sense as it is clearly implemented in the code, anybody seen this. Has anybody encountered something like this? It's probably more Unity related but as it is blocking me right now I'm trying my luck here as well.

@somdoron
Copy link
Member

Are you using PGM ? I'm not sure it is working with Unity.

Also if using PGM make sure to install the MSMQ multicast from Windows Components.

@Borisss
Copy link
Author

Borisss commented Sep 20, 2016

I'm not aware of using it directly, dll runs well when used in win/linux build (apart from very rare occurence of #526).

This is basically my whole code regarding NetMQ:

`// Client thread which does not block Update()
protected override void NetMQClient()
{
AsyncIO.ForceDotNet.Force();
NetMQConfig.Cleanup();

        client = new DealerSocket();
        client.Connect(clientPath);

        using (var server = new RouterSocket())
        {
            server.Bind(connectPath);

            var timeout = System.TimeSpan.FromSeconds(timeOutSeconds);
            NetMQMessage msg = new NetMQMessage();

            while (!stop_thread_)
            {
                if (server.TryReceiveMultipartMessage(timeout, ref msg))
                {
                    var msgData = msg[1].ConvertToString();
                    ...
                }
            }

            client.Close();
            server.Close();
            NetMQConfig.Cleanup();
        }
    }`

This well may be an issue on Unity site, their webGL build config is still very immature. Unity claimed some of the compilation errors to be fixed in 5.5b3 version but I reproduced it there as well.

@mikaelhogstrom
Copy link

Wait, WebGL can't handle several threads though, can it?

@Borisss
Copy link
Author

Borisss commented Sep 27, 2016

Hi, this is the updated reply from Unity team, they claim there is some C# 6 feature in NetMQ3.5, can I get rid of that?

Boris,

Thanks for submitting this bug report. Unfortunately, IL2CPP does not provide a useful error message in this case. The real problem is that the NetMQ.dll assembly uses C# exception filters, which are only available in C# 6 and are not supported by Unity now. I'm going to improve the error message in this case, so that it is clear what the real source of the problem is.

If there is a version of the NetMQ.dll assembly that does not use exception filters, I would recommend trying that.

Also, we're working now on upgrading Unity to use a modern version of .NET and C#. You can track the status of that effort in our scripting previews section of the forums: http://forum.unity3d.com/forums/experimental-scripting-previews.107/

Please let me know if you have any questions.

Josh Peterson
Developer - Scripting VM Team

@somdoron
Copy link
Member

Feel free to send a PR that removes them...

@Borisss
Copy link
Author

Borisss commented Sep 29, 2016

Feel free to send a PR that removes them...

I'm not a Git guy so I don't really know how that is done (using SourceTree), basically what needed to be changed was only this line in PGMSender ( StartConnecting() ):
catch (SocketException ex) { if (ex.SocketErrorCode == SocketError.InvalidArgument) Error(); }
to not use 'when'

Wait, WebGL can't handle several threads though, can it?

after finally being able to build I did find this out, has anybody used netMQ with Unity WebGL? Should rewrite the code with coroutines? What about performance hit? [should this be a different topic?]

@mikaelhogstrom
Copy link

They say threading is on the roadmap for web gl so depending on how important Web GL platform is for you you might want to try and wait it out.

@stale
Copy link

stale bot commented May 15, 2020

This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.

@stale stale bot added the stale label May 15, 2020
@stale stale bot closed this as completed Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants