.Net 3.5 Compatibility

Oct 5, 2013 at 7:48 AM
Edited Oct 5, 2013 at 8:01 AM
Hello,

Is this library compatible with .Net 3.5? I saw it requires .Net 4.0 in the documantation. But is it possible to make this library work in .Net 3.5 too?

Edit: And also is it possible to use this library as dll?
Coordinator
Oct 5, 2013 at 5:29 PM
Hello there,

Is this library compatible with .Net 3.5?
Currently the library cannot be compiled in .NET Framework 3.5 or below.
If you wish to do so, you'll need to :
  • Make minor changes and not use both Testinvi and the UILibrary.
  • Remove the [ExcludeFromCodeCoverage] which seems to be be available from 3.5.
I currently cannot provide you a working solution as my development PC is dead.

And also is it possible to use this library as dll?

I don't think I undersand your question correctly. Tweetinvi is a set of libraries that you can download from the download section or from Nuget.
ZIP
NUGET

I will try to come back with a more detailed answer when I have my computer back.

Sincerely,
Linvi
Oct 6, 2013 at 3:15 PM
Hello Linvi,

Thanks for the response. I am trying to make this work within Unity3D so that was why I asked for .Net 3.5. Have you ever talked to someone who tries to use these libraries with Unity3D? When I try to import the dll. it gives the following error:

Internal compiler error. See the console log for more information. output was:


Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

Do you have any idea what can cause this error?

Thanks in advance,
My Bests,
Emre
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

Coordinator
Oct 6, 2013 at 6:19 PM
Edited Oct 6, 2013 at 6:23 PM
Hello Emre,

Enabling .NET 3.5 for Tweetinvi implies many refactoring that will be performed in later versions.
I have personally never used Unity3D but it seems that it tries to perform reflection on Tweetinvi using Mono.
I don't know the reason why Unity3D is trying to do that but it seems that it tries to load references dynamically.
One thing that you might want to try is loading the DLL manually and inform Unity that the loading has been performed.

Are you developing in a Linux environment? If so, I know that mono has many requirements that the Tweetinvi API might not match.
The Framework version might also be an issue.

In your current situation, if you wish to use Tweetinvi, I would advise that you use it as external libraries and not include the library inside your C# project.

I am sorry to tell you that in the current state of the API I cannot help you more than that.
I have been able to compile in 3.5 but there is too much elements that might become unstable that I do not wish to release such a version.

Also please consider upgrading your project (if new) to a more advance .NET Framework as the 3.5 starts to become old as we are starting to speak of the .NET Framework 5.0.

I hope you will understand.

Regards,
Linvi
Nov 28, 2013 at 7:47 PM
Just for the record, I had a recent problem with this as well. Although Mono supports .NET 4 / 4.5, Unity3D 4.x only supports .NET 2.0. Technically, .NET 3.5 leverages the 2.0 CLR as well so it can load any 3.5 project. Unity cannot load assemblies greater than 3.5.

To solve my problem, I wrote a separate process to host Tweetinvi and uses WCF / REST to stream messages to the Unity game.

Please coordinator, consider cross-compiling your project against different compilation targets and only expose platform specific API only for those who require it.
Coordinator
Nov 28, 2013 at 9:02 PM
Hi Bcook,

Thanks you for your comment which I think is quite interesting.
I did not wish to use 3.5 because the platform is starting to get old and even though there are use cases for .NET 3.5.

I think your solution is currently the best one to use Tweetinvi for platforms targeting .NET which is older than 4.0.
In fact the next version 0.9.0.0 separates the Model from the DTO in the goal of simplifying the usage of DataContracts (WCF) on the DTO objects.

Again thank you for the comment.
Kind Regards,
Linvi