Jump to content

[Answered] Are DLLs compiled with Roslyn (C# 6) compatible with Linux/OSX KSP?


Recommended Posts

I would like to take advantage of some of the new language features in C# 6/Visual Studio 2015 but I'm unsure whether the result is mono compatible. Testing on my Win 10 machine shows no problems. Anyone know if Linux or Mac OS versions of KSP would have any problem with the DLL? (The compile target is still .NET 3.5.)

Edited by Aelfhe1m
Set title to answered
Link to comment
Share on other sites

1 hour ago, Thomas P. said:

As long as they don't use .NET 4+ specific things, such as async, they are completely compatible with Mono, since the result is still valid IL code.

Thanks. Thought that should be the case but nice to have confirmation.

Link to comment
Share on other sites

They are. You can even compile with Roslyn on Linux. The last few Mechjeb-dev and  ModuleManager are build with Roslyn on Linux. 

I will most likely start to use C# features 6 soonish, but I am afraid of the impact of people who help with my mods...

Link to comment
Share on other sites

1 hour ago, sarbian said:

They are. You can even compile with Roslyn on Linux. The last few Mechjeb-dev and  ModuleManager are build with Roslyn on Linux. 

Oh, last I looked mono was still catching up with some of the Roslyn features (not that those specific features were ones I planned to use for modding) or has Microsoft released a Linux native compiler that I haven't noticed?

Quote

I will most likely start to use C# features 6 soonish, but I am afraid of the impact of people who help with my mods...

Yes, could be a concern with more collaborative mods but C# 6 is mostly just syntactic sugar.

After you've seen ?. and $"{}" used a couple of times I find it becomes second nature for most people. Anyone that's done a lot of Linq or Func programming is used to the => lambda arrow so expression body methods look natural too.

Edited by Aelfhe1m
Link to comment
Share on other sites

10 hours ago, Aelfhe1m said:

Oh, last I looked mono was still catching up with some of the Roslyn features (not that those specific features were ones I planned to use for modding) or has Microsoft released a Linux native compiler that I haven't noticed?

Yes, could be a concern with more collaborative mods but C# 6 is mostly just syntactic sugar.

After you've seen ?. and $"{}" used a couple of times I find it becomes second nature for most people. Anyone that's done a lot of Linq or Func programming is used to the => lambda arrow so expression body methods look natural too.

The mono compiler does not officially support .NET 3.5 so I did not want to take risk (and I somehow trust the MS compiler to generate better IL). Having Roslyn run on linux involve the really complex procedure of copying 8 files from a Windows PC ;) or a convenient project

 ?. and $"{} is what I am interested most. I have read that ?. may ont work properly with Unity object since they override the equality operator. I need to test that

Linq is nice but allocate far too many object with Unity old Mono. The Func is something I need to look into more since I don't really see the point so far (beside the compact form, and the obvious use with Linq)

Edited by sarbian
Link to comment
Share on other sites

9 hours ago, sarbian said:

I have read that ?. may ont work properly with Unity object since they override the equality operator. I need to test that

If I'm reading that article correctly then the override is only applied in the Unity editor itself so would not affect the vast majority of KSP mods that are never run there (may affect the debugging experience though if you hook up through Unity but I've not reached that level of complexity yet). I've done a little testing with FlightGlobals.ActiveVessel?.XXX and on the returned sub-objects and they seem to work as expected with no spurious values or NREs in the game log. Not definitive by any means but a hopeful indication.

Edited by Aelfhe1m
afterthought
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...