silentorbit/protobuf

Fail to compile on Mono due to System.Collections.Concurrent

ido-ran opened this issue · 9 comments

Hi,
I manage to compile the source code of the ProtoBuf generator on Mono on Mac OS but after I build the message source code I get a compilation error due to this line:
using System.Collections.Concurrent

Is it possible to add switch to not use this feature because AFAIK .NET 4 is not available on Mono at this point.

I'll see if we can get a conditional flag there.

Otherwise you can pretty safely remove that part of the code since you're not going to use it. The "generated" protocolparser.cs is always the same for any given version of this project, that is, not dependent on the proto specs you pass into the generator.

Although i do believe mono has supported .NET 4/c#4.5 for some time now. I've compiled it on Linux using mono(that is also where i develop it).
My guess is that there is at least a newer version included with Xamarin Studio.

Let me know if that fixes it or if I should get on the conditional flag solution.

Hi,
I've currently workaround this by doing what you suggested and removing the using statement as well as the experimental new class.
I'm know the .NET inside out but on the mono side I'm still pretty newbe, I've yet to understand why the Mono team decide on such different version numbers. Also I'm developing in Mono for Unity 4 and the Unity team is using very old Mono version so I'm afraid I'm stuck in this situation even if .NET 4 support exist for Mono.

I guess my need is an edge case, I'll understand if this not worth the effort.

Thank you,
Ido.

Do you know if Unity by default add any flag that I could use to exclude the code?

For example

#if !UNITY
using System.Collections.Concurrent;
#endif

Unity does add flags but I'm writing a plugin to Unity so it's not a Unity project by itself.
What do you think about opt-in the experimental class instead of opt-out of it?

I have same feature request for unity project.

I hope this is OK.
I rather make the newer .NET versions/features the default so the flag must be added for targeting older versions of the framework.

Sometimes it is hard to compile on mac and linux, it will be very useful if you can provide a release file like https://github.com/hultqvist/ProtoBuf/releases/download/2014-08-23/ProtoBuf-2014-08-23-bin.zip

@guileen I'll do that tonight when I'm back at my Linux machine :)

If possible I suggest using http://www.mono-project.com/download/#download-lin rather than what is supplied by the distro which can be quite old.