zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.96k stars 744 forks source link

.NET 3.5 compatibility #98

Closed cncfanatics closed 10 years ago

cncfanatics commented 11 years ago

I write games using Unity 3D.

Unity 3D uses mono to run managed code, while the engine itself is written in another language. This means all extra programming happens using mono. Unfortunatly, it's a rather outdated version of mono that doesn't have any of the features of .NET 4.0.

NetMQ refuses to run on it, is it possible to fix this ?

(I could possibly do this myself with some guidance on how to do this)

somdoron commented 11 years ago

Download the source code and try to compile with .net 3.5, I don't think the project is using some .net 4 features.

On Fri, Aug 30, 2013 at 2:37 PM, Diego Duclos notifications@github.comwrote:

I write games using Unity 3D.

Unity 3D uses mono to run managed code, while the engine itself is written in another language. This means all extra programming happens using mono. Unfortunatly, it's a rather outdated version of mono that doesn't have any of the features of .NET 4.0.

NetMQ refuses to run on it, is it possible to fix this ?

(I could possibly do this myself with some guidance on how to do this)

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/netmq/issues/98 .

tobi-tobsen commented 11 years ago

I quickly created a patch which compiles under 3.5 client profile. As you see, I didn't change the Security and NetMQScheduler but just delete/excluded both. Also the tests still compile under 4.0 because they make excessive use of Task I you want to have the NetMQScheduler, you might want to implement a ConcurrentBag using one of those approach mentioned in this Stackoverflow Question.

I think others than compiling under 3.5 client profile, you might check out issue #7 for other open issues regarding mono support. If you worked around those, be sure to submit a pull request ;-)

cncfanatics commented 11 years ago

Patch applied, it compiles perfectly indeed, I'll be testing it in the next few days as I change my app to use NetMQ instead of clrzmq

Thanks!

cncfanatics commented 11 years ago

I can confirm this looks good after some initial quicktesting with mono 2.6! This is currently on windows, but I'll be testing on linux soon as well and report what I find :+1:

Is it worth considering making the code compile under both environments and add preprocessor statements around functionality making heavy use of the 4.0 framework ?

reiroldan commented 11 years ago

There are quite a few people wanting to use netmq within Unity3D so I think it's a welcome addition @cncfanatics.

JamesWHurst commented 11 years ago

What is the current status of this? I'm interested in this too - creating a software component that needs to be deployable on .NET 3.5. I'm using compiler pragmas PRE_4 to signal use of pre-.NET 4.0 features, and PRE_5 to signal use of pre-.NET 4.5/C# 5.0 features. Which does give me some gnashing of teeth as I do love using the latest language features!

JamesWHurst commented 11 years ago

I now have a solution for the .NET 3.5 compatibility issue, and am about to submit a request to update. This only targets the Windows side - if it's accepted then I'll also do the Mono side if that is wished. Included in this are some edits to the tests to make them compile/test under 3.5. It was necessary to incorporate a conditional-compilation symbol: "PRE_4", to signal that the project is to be built using only pre- .NET 4.0 features. The Security is included, but I omitted NetMQScheduler since that probably doesn't make much sense under 3.5. I built and tested on a virtual machine which has only VS 2008, and no .NET higher than 3.5. This is my first contribution so any advice would be appreciated.

luna-duclos commented 11 years ago

I'd personally be a big fan of the mono side. Unity specifically uses a rather old version of mono which would require this.

JamesWHurst commented 11 years ago

Ok - working on that now (I'm between jobs at the moment, lamentably, so I have some time to devote to this right now). Exactly which version of Mono does the current version of Unity require? And - btw, what is the exact command-path that one uses to submit a 'git push' of one's changes? I'm getting various errors as I try different variations of the line under [remote "origin"]. I tried url = ssh://git@github.com/zeromq/netmq.git, and other variations with my user nickname ( JamesWHurst ) at various places within that. None work.

reiroldan commented 11 years ago

Unity targets 3.5 features of Mono though it uses a custom build. I'm not exactly sure what the changes they applied are, but I believe that just targeting the 3.5 .net framework should suffice.

@JamesWHurst Regarding the push issues you are having, please read: https://help.github.com/articles/fork-a-repo

JamesWHurst commented 11 years ago

I had read that page - those commands are not working for me. Eg, git push results in ERROR: Permission to zeromq/netmq.git denied to JamesWHurst. fatal: Could nto read from remote repository.

reiroldan commented 11 years ago

Because you are trying to push to the main repository and not your forked copy. You should fork the main, pull that, make a branch, write your changes, commit / push. Go back to github and a nice little button "pull something something" will show up.

JamesWHurst commented 11 years ago

Ok. I had clicked on the "Fork" button on the github page. I didn't see anything happen. I had pulled that down onto my local drive, put my edits there. So, just now, I created a branch on my local box using git branch Net35CompatFix (the intent was to name the branch Net35CompatFix). Then I entered git checkout Net35CompatFix to move over to that branch. Now, how do you bring this branch up to Github? On the Github page, I created the branch named Net35CompatFix. Do I now need to enter the command: git push --set-upstream origin Net35CompatFix ? Or does that push my edits into the master instead of into my branch?

almazik commented 11 years ago

James,

It seems that you are not familiar with Pull Requests contribution model. I suggest you to read the following article first: https://help.github.com/articles/using-pull-requests

On Tue, Oct 15, 2013 at 10:21 PM, James Hurst notifications@github.comwrote:

Ok. I had clicked on the "Fork" button on the github page. I didn't see anything happen. I had pulled that down onto my local drive, put my edits there. So, just now, I created a branch on my local box using git branch Net35CompatFix (the intent was to name the branch Net35CompatFix). Then I entered git checkout Net35CompatFix to move over to that branch. Now, how do you bring this branch up to Github? On the Github page, I created the branch named Net35CompatFix. Do I now need to enter the command: git push --set-upstream origin Net35CompatFix ? Or does that push my edits into the master instead of into my branch?

— Reply to this email directly or view it on GitHubhttps://github.com/zeromq/netmq/issues/98#issuecomment-26364137 .

JamesWHurst commented 11 years ago

That is correct. I have used many other version-control systems, but never Git. I have a little book here, "Pragmatic Guide to Git", which doesn't feel like it's quite helping. And that article you list - I'd already read. It explains a few generic concepts, but the specific commands it lists don't seem to work. Nothing seems to be working as it is supposed to. I guess I should have just done a very tiny edit or bug-fix before attempting this, so that I wouldn't have wasted so many days before discovering this is something I cannot use.

JamesWHurst commented 11 years ago

Actually - no. I had already done the Fork, cloned the repo to my desktop cptr, created a branch, and then added and committed my changes to my local branch. And I created a branch on that Github page by the same name - Net35CompatFix, by clicking on the webpage-control. And, I understand how to make a pull-request. It is just the process of pushing my repo from my local machine, up to the branch on the Github repo, that is not happening. At this point it would have been faster to copy it onto a pile of floppy-disks, duck-tape those to the back of a turtle, and send it in the direction of the Github server to be manually unpacked and transferred. This is why I should try to stay away from open-source.

reiroldan commented 11 years ago

James... you create the branch on your local fork (on your computer).

Regarding your comment on why you stay away from open-source, sad you think that way, but given the hundreds of thousands of people currently working with github, I doubt it's a problem with OSS/git ;)

JamesWHurst commented 11 years ago

I had. Perhaps it is best to start over. I receive a ton of 'how-to' advice, most of which turned out to be incorrect. The first step is for Fork, right? And we accomplish this by clicking on the "Fork" button at the upper-right corner of the Github project page? Attached is a screenshot of it, after I clicked on it. The only change I see, is that the number to the right of it incremented from 34 to 35. Is this correct so far? fork

reiroldan commented 11 years ago

Now, the "HTTPS clone url" on the bottom right is the url you should be cloning onto your computer. This is your "personal" version of the repository as you can see from the "JamesWHurst/netmq" project. Make a branch, make your changes, commit and push. Then, from your repository on git, you'll be offered the option to create a pull request to the main repository, which we can then pull in.

JamesWHurst commented 11 years ago

Aha! Thx. So on my local box I entered at a command-line: git clone https://githumb.com/JamesWHurst/netmq.git That seemed to operate ok. To confirm: the next steps are to create a branch on my local box, merge in my changes, commit, and then enter "git push" - right?

reiroldan commented 11 years ago

Basically yes, you create a branch on local box, hack on it, commit then push. After that, you go to your repo at: https://github.com/JamesWHurst/netmq and you'll get an option to create a pull request from your committed branch.

On a side note, until you get accustomed to using git, you might want to give a git gui tool a try, something like TortoiseGit or SmartGit. (I personally use TortoiseGit as its quite fast and simple to use).

JamesWHurst commented 11 years ago

What exactly is the correct command to push the commits back to my branch on the repo? On my local box, I am "in" branch Net35CompatFix. When I entered "git push", it responds: fatal: The current branch Net35CompatFix has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin Net35CompatFix. Is that what I need to enter? Thanks, jh

reiroldan commented 11 years ago

I believe you'd do: git push -u origin Net35CompatFix

the -u will automagically add the upstream for you for future uses, so you'd be able to perform a git push, on successive pushes without being asked for the upstream branch.

JamesWHurst commented 11 years ago

Thank you reiroldan - I appreciate your help. Your recommendation worked splendidly, and the Pull Request is in.

I appreciate your helping me through this!

jh

reiroldan commented 11 years ago

Glad I could help you through that ;)

DirkBroenink commented 10 years ago

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.)

If I download tobi-tonsen's patch, how do I apply it? Where can I find the download for JamesWHurst's branch?

somdoron commented 10 years ago

download git from http://git-scm.com/downloads and install git for windows.

open command prompt and create a directory for your git repositories.

than run "git clone https://github.com/PSG-Sakari/netmq.git"

you now have a new directory called NetMQ, open it, open src folder, open the solution and compile.

On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) Could anyone give me some pointers?

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48165261.

DirkBroenink commented 10 years ago

Thanks!

It worked!

Question: how did you know about the existence of the PSG-Sakari fork? Next time I should be able to find something like that myself.

On Mon, Jul 7, 2014 at 1:15 PM, Doron Somech notifications@github.com wrote:

download git from http://git-scm.com/downloads and install git for windows.

open command prompt and create a directory for your git repositories.

than run "git clone https://github.com/PSG-Sakari/netmq.git"

you now have a new directory called NetMQ, open it, open src folder, open the solution and compile.

On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) Could anyone give me some pointers?

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48165261.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48166323.

cncfanatics commented 10 years ago

I've put in a pull request for it, you can see it under the pull requests list in the original repo :)

Note: I'm planning on updating that fork soon with a more up-to-date way of supporting both 3.5 and 4.5 if you're interested. You'll see the changes appear likely tonight or tomorrow

On Mon, Jul 7, 2014 at 2:19 PM, Taboen notifications@github.com wrote:

Thanks!

It worked!

Question: how did you know about the existence of the PSG-Sakari fork? Next time I should be able to find something like that myself.

On Mon, Jul 7, 2014 at 1:15 PM, Doron Somech notifications@github.com wrote:

download git from http://git-scm.com/downloads and install git for windows.

open command prompt and create a directory for your git repositories.

than run "git clone https://github.com/PSG-Sakari/netmq.git"

you now have a new directory called NetMQ, open it, open src folder, open the solution and compile.

On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) Could anyone give me some pointers?

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48165261.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48166323.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48171162.

DirkBroenink commented 10 years ago

Just be sure I am getting this. You are requesting to put your changes into zeromq/netmq with that pull request, right?

Also, if it's yours, you should know I had some problems compiling your version with VS2012, I had to comment out the entire NetMQScheduler class in order for the compilation to work for the Net35 project. It compiled out of the box for all other projects, but not for Net35. These are the errors I got when compiling the first time:

etc etc, for classes ThreadLocal, TaskScheduler, Task, ConcurrentBag, Concurrent, TryExecuteTask, TaskCreationOptions. In other words, for .NET 4.0 specific classes. Notice how it gave the errors when compiling the Net35 project, but the path is in the Net45. I don't understand why this happens, but when I commented out the entire class it worked. This was the only class in which errors occurred. (Commenting out the class caused new errors in the TestNetMQScheduler class, but I don't need that to work).

After commenting it, compiling a new version, it works perfectly in Unity3D.

Gr, Dirk

On Mon, Jul 7, 2014 at 2:20 PM, Diego Duclos notifications@github.com wrote:

I've put in a pull request for it, you can see it under the pull requests list in the original repo :)

Note: I'm planning on updating that fork soon with a more up-to-date way of supporting both 3.5 and 4.5 if you're interested. You'll see the changes appear likely tonight or tomorrow

On Mon, Jul 7, 2014 at 2:19 PM, Taboen notifications@github.com wrote:

Thanks!

It worked!

Question: how did you know about the existence of the PSG-Sakari fork? Next time I should be able to find something like that myself.

On Mon, Jul 7, 2014 at 1:15 PM, Doron Somech notifications@github.com wrote:

download git from http://git-scm.com/downloads and install git for windows.

open command prompt and create a directory for your git repositories.

than run "git clone https://github.com/PSG-Sakari/netmq.git"

you now have a new directory called NetMQ, open it, open src folder, open the solution and compile.

On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) Could anyone give me some pointers?

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48165261.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48166323.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48171162.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48171265.

cncfanatics commented 10 years ago

After a quick check, this is likely caused by not getting the nuget dependencies, which is just fine if you don't intend to use the scheduler anyway.

On Mon, Jul 7, 2014 at 2:36 PM, Taboen notifications@github.com wrote:

Just be sure I am getting this. You are requesting to put your changes into zeromq/netmq with that pull request, right?

Also, if it's yours, you should know I had some problems compiling your version with VS2012, I had to comment out the entire NetMQScheduler class in order for the compilation to work for the Net35 project. It compiled out of the box for all other projects, but not for Net35. These are the errors I got when compiling the first time:

  • Error 7 The type or namespace name 'ThreadLocal' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Dirk\Desktop\netmq-master\src\Net45\NetMQScheduler.cs 25
  • Error 8 The type or namespace name 'ThreadLocal' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Dirk\Desktop\netmq-master\src\Net45\NetMQScheduler.cs 26

etc etc, for classes ThreadLocal, TaskScheduler, Task, ConcurrentBag, Concurrent, TryExecuteTask, TaskCreationOptions. In other words, for .NET 4.0 specific classes. Notice how it gave the errors when compiling the Net35 project, but the path is in the Net45. I don't understand why this happens, but when I commented out the entire class it worked. This was the only class in which errors occurred. (Commenting out the class caused new errors in the TestNetMQScheduler class, but I don't need that to work).

After commenting it, compiling a new version, it works perfectly in Unity3D.

Gr, Dirk

On Mon, Jul 7, 2014 at 2:20 PM, Diego Duclos notifications@github.com wrote:

I've put in a pull request for it, you can see it under the pull requests list in the original repo :)

Note: I'm planning on updating that fork soon with a more up-to-date way of supporting both 3.5 and 4.5 if you're interested. You'll see the changes appear likely tonight or tomorrow

On Mon, Jul 7, 2014 at 2:19 PM, Taboen notifications@github.com wrote:

Thanks!

It worked!

Question: how did you know about the existence of the PSG-Sakari fork? Next time I should be able to find something like that myself.

On Mon, Jul 7, 2014 at 1:15 PM, Doron Somech notifications@github.com

wrote:

download git from http://git-scm.com/downloads and install git for windows.

open command prompt and create a directory for your git repositories.

than run "git clone https://github.com/PSG-Sakari/netmq.git"

you now have a new directory called NetMQ, open it, open src folder, open the solution and compile.

On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:

Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) Could anyone give me some pointers?

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48165261.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48166323.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48171162.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48171265.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-48172521.

MSylvia commented 10 years ago

@Taboen Do you happen to have a simple example of this running in Unity3D? Got 3.5 compiled but it crashes on play.

tobi-tobsen commented 10 years ago

No, sorry. I think @Taboen was able to use it in Unity3D. It seems there is an increased demand for that. And I hope @cncfanatics replies to my remarks so we might get his .Net 3.5 support in. What do the other Collaborators think (e.g. how to handle it in reagrds to nuget)?

MSylvia commented 10 years ago

Ya sorry about that. Your names were similar in the auto-complete user tagging. I ment @Taboen.

luna-duclos commented 10 years ago

I have an updated and much improved version of this I still need to push! (Sorry, still didn't get to it). I have a weekend of family crap to go through, and I'll see to it it's done on sunday.

To fix this properly, I've gone through backporting much of the BSD licensed 4.5 mono framework, and conditionally include it as dependency of NetMQ depending on whether we're running on 3.5 or 4.5. What do people think of this approach ?

As a free bonus, it adds a lot of 4.5 features to the 3.5 Unity runtime

tobi-tobsen commented 10 years ago

@PSG-Sakari to be honest, I have no idea if the licences are a problem or not. Imo "conditionally include it" sounds not too good, I liked your other approach better (having separate projects for 3.5 and 4.5). That seemed to be not as invasive as your new approach - but I might be wrong since I am unsure what needed back porting.

luna-duclos commented 10 years ago

i ended up backporting a large part of the 4.5 framework because I was going to need it anyway. You're right, this is likely much too big. I'll keep with this approach and finish it up on sunday

somdoron commented 10 years ago

Why do we need 4.5 version? what features of 4.5 do we need?

With Nuget you can ship two different binaries targeting different .net frameworks. However if we are going to add a dependency on the parallel extension library I suggest to have a different nuget package aiming .net 3.5 (maybe this can solved with nuget as well, but i'm not sure).

In my opinion the end result should be two csproj files, one aiming .net 3.5 and one for .net 4.0. We might need to add some if define condition in the code and should try keep those to a minimum.

DirkBroenink commented 10 years ago

@MSylvia This compiles and works for me: http://pastebin.com/EHvt4Na7 If this doesn't work something probably went wrong when compiling the NetMQ library in 3.5 mode, @cncfanatics helped me with that, read comments above. I followed the steps he described.

MSylvia commented 10 years ago

Hmmm it could be that I'm on OSX. Last thing the log shows before the crash is

Platform assembly: /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/Mono.Posix.dll (this message is harmless)
Receiving unhandled NULL exception

So there may need to be some OSX checks in OpCode.cs around line 30

Launching bug reporter
Obtained 48 stack frames.
#0  0x0000009149c9f4 in memmove$VARIANT$sse42
#1  0x0000000470d7a7 in ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged
#2  0x0000001116b73f in  (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_to_unmanaged (System.Array,int,intptr,int) + 0x57 (0x1116b6e8 0x1116b792) [0x6707a80 - Unity Child Domain]
#3  0x0000001116b6c3 in  System.Runtime.InteropServices.Marshal:Copy (byte[],int,intptr,int) + 0x33 (0x1116b690 0x1116b6da) [0x6707a80 - Unity Child Domain]
#4  0x0000001116aa6a in  NetMQ.zmq.Native.Opcode:Open () + 0x7a2 (0x1116a2c8 0x1116ab36) [0x6707a80 - Unity Child Domain]
#5  0x0000001116a1ce in  NetMQ.zmq.Clock:.cctor () + 0xf6 (0x1116a0d8 0x1116a2b9) [0x6707a80 - Unity Child Domain]
#6  0x0000000e708678 in  (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) + 0x88 (0xe7085f0 0xe708740) [0x6707a80 - Unity Child Domain]
#7  0x000000045f98c5 in mono_get_runtime_build_info
#8  0x0000000472c78b in mono_runtime_invoke
#9  0x0000000472cd4e in mono_runtime_class_init_full
#10 0x000000045f768f in mono_jit_compile_method
#11 0x000000045f68b5 in mono_jit_compile_method
#12 0x0000000472e3d4 in mono_compile_method
#13 0x000000046748be in mono_magic_trampoline
#14 0x0000000630d066 in mono_magic_trampoline
#15 0x00000011169171 in  NetMQ.zmq.SocketBase:Bind (string) + 0xc1 (0x111690b0 0x11169ae1) [0x6707a80 - Unity Child Domain]
#16 0x00000011169010 in  NetMQ.zmq.ZMQ:Bind (NetMQ.zmq.SocketBase,string) + 0xa8 (0x11168f68 0x11169027) [0x6707a80 - Unity Child Domain]
#17 0x00000011168f3f in  NetMQ.NetMQSocket:Bind (string) + 0x37 (0x11168f08 0x11168f56) [0x6707a80 - Unity Child Domain]
#18 0x000000171fea3e in  TestNetMQ:Start () + 0x8e (0x171fe9b0 0x171fed3c) [0x6707a80 - Unity Child Domain]

I'll have to try some builds on windows and linux as well. @Taboen what platform was your unity build for?

DirkBroenink commented 10 years ago

@MSylvia My Unity build was compiled for Windows 7.

JamesWHurst commented 10 years ago

I had created an update to NetMq that allowed for .NET 3.5 compatibility - did it not make it into the project? (sorry - I've been overseas for most of this past year). It was no small amount of work to do. Yes, it did require a separate project file for 3.5, and 4.0. And (looking at some of your other comments above) if we do not use conditional-compilation within the source-code, and instead have two separate sets of code (one for 3.5, and one for 4.0) then you award yourself with the responsibility of keeping two code-bases in-sync, which I submit is a pain and not worth it. As much as it [would seem to] complicate the code where you see those conditional-compilation pragmas, in reality it was not in that many places, and it means all the rest of the code can be in one set of files. That, is what it is meant for, and I suggest we use it. I suggested (and followed) the convention that every conditional-compilation pragma be listed within the design documentation, and at the top of every source-code file where it is used. It became even more desirable when I also created a version for Windows Store apps, which lamentably involves a rather massive change in, for example, the sockets API.

somdoron commented 10 years ago

@JamesWHurst can you solve the merge conflicts on the pull request? let me know when you did and I will merge it.

On Tue, Jul 29, 2014 at 9:48 AM, James Hurst notifications@github.com wrote:

I had created an update to NetMq that allowed for .NET 3.5 compatibility - did it not make it into the project? (sorry - I've been overseas for most of this past year). It was no small amount of work to do. Yes, it did require a separate project file for 3.5, and 4.0. And (looking at some of your other comments above) if we do not use conditional-compilation within the source-code, and instead have two separate sets of code (one for 3.5, and one for 4.0) then you award yourself with the responsibility of keeping two code-bases in-sync, which I submit is a pain and not worth it. As much as it [would seem to] complicate the code where you see those conditional-compilation pragmas, in reality it was not in that many places, and it means all the rest of the code can be in one set of files. That, is what it is meant for, and I suggest we use it. I suggested (and followed) the convention that every conditional-compilation pragma be listed within the design documentation, and at the top of every source-code file where it is used. It became even more desirable when I also created a version for Windows Store apps, which lamentably involves a rather massive change in, for example, the sockets A PI.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/netmq/issues/98#issuecomment-50441425.

martinjo commented 10 years ago

Did anyone get netmq to work in Unity3D on OS X or iOS?

When I debug in Uniy, it randomly hangs when creating my first context ( NetMQContext.Create(); ) and I'm not sure how to proceed to debug it further...

martinjo commented 10 years ago

I managed to get the inproc-communication working in Unity3d (on OSX) by changing "Mono.Posix."... to "Mono.Unix" in opcode.cs.

Tcp connections are still not working though, and it's near impossible to debug since Unity3d constantly hangs while trying.

Any suggestions about this? I tried the code in Xamarin studio (using mono 3.6) and it works perfectly with tcp there...

Mystfit commented 10 years ago

I'm also having the same issue with Netmq on OSX, specifically inside Unity. I've been running the .NET35 compatibility branch without issue for around half a year now on Windows but attempting to send a message through any socket (without noWait) will hang Unity indefinitely on OSX.

krisrok commented 10 years ago

ah what a pity. i'm currently researching for a communication backbone of an upcoming project and thought i'd finally found it - until reading through the thread just now.

as we plan to target unity at some point i hope there is still someone hearing our pleas :)

Mystfit commented 10 years ago

I've been working through merge conflicts for porting this patch to the current master branch but it's still hanging on Unity in OSX. It will run standalone in Mono properly but either the Reaper or IO threads will freeze in Unity. It's been hard to debug since the C# code has to be run from inside Unity directly else the debugger just merrily skips over code in a DLL.

krisrok commented 10 years ago

@mystfit have you tried the other guy's pull request with mono/osx? and from your other comment i assume you had success on unity/win with this one?

Mystfit commented 10 years ago

@krisrok I've been using @JamesWHurst 3.5 compatibility patch in Unity from January onward and it's been fine in Windows. I experimented with applying this patch in OSX only recently, but had no luck with either versions. I haven't tried this patch in Windows yet.

I tracked down one of my thread hangs to one of these three lines where MonoDevelop and Unity would become unresponsive. I think that it happens in one of the IO Threads but I'm having a hard time determining if that's the case.