Improbable Icon


.NET Core Support Possible?



Hey all!

First of all, massive shoutout to Improbable for such a cool project! I’m absolutely enamored with it and and incredibly excited to use it!

I do, however, have a question; Is there any plan to support .NET Core in addition to Mono for C# (and potentially F#) workers? Applications that target netcoreapp2.0 should have an incredibly similar API surface relative to Mono 5, though I’ve had no success using custom build scripts. It seems that the generated C# code attempts to make sizeof calls to managed types, which results in a CS0208 error (Cannot take the address of, get the size of, or declare a pointer to a managed type) on various types, in addition to missing assembly references.

Any word from Improbable on .NET Core support?

For posterity, I was using the command dotnet publish -f netcoreapp2.0 -r osx-x64 -c Release to build binaries, and it works fine without the generated code, publishing an executable and DLLs for all the assemblies the binary depends on. The addition of <AllowUnsafeBlocks>true</AllowUnsafeBlocks> fixed compilation errors in regards to unsafe code, but CS0208 and CS0234 have proved troublesome!


Hi @berwyn, terribly sorry for letting this slip through the cracks and not getting you an answer sooner. Unfortunately the official answer is that we haven’t really looked into this at all. So while it might be the case that all that is needed is a couple small fixes, we aren’t sure at the moment and are prioritizing development of the language workers we support right now.

I’ve shown this question to some engineers on our core SDK teams so they are aware, and if any of them come up with anything else that would be helpful we’ll be sure to pass it on. Sorry that I don’t have more for you at the moment, but thank you for your kind words and good question!


I need to bump this because currently the lack of modern C# support is the only reason we can’t go with SpatialOS. There is simply no reason to stick with Mono anymore. It is inferior in every way.


Hey @jeremies. I work in the team which maintains the C# worker SDK.

Agreed with what you said. Fortunately, we’ve actually been looking into .NET Core support pretty recently, and as of SDK 13.3.0 the C# assemblies we distribute are in fact fully compatible with .NET Core. The biggest issue right now preventing us from announcing it is that our documentation and C# blank project (including the generated build scripts for C#) was written before .NET Core was available, and they using the old MSBuild format used with .NET Framework on Windows, and Mono on macOS and Linux. This unfortunately doesn’t work out of the box with the relatively new dotnet tooling.

Referring to the compiler issues highlighted by @berwyn above, I can’t personally reproduce the CS0208 error, so I can only assume we inadvertently fixed that issue in the meantime whilst fixing something else. The only issue I encountered is the unsafe blocks. However, due to the fact that our generated serialization code relies on calling into native libraries, the unsafe blocks cannot be avoided for now.

We are looking into adding first class support for .NET Core which is tested as part of our CI, including accompanying documentation and examples in the near future, potentially by the next minor release. However, in the meantime, I’ve uploaded the experimental .NET Core project I created to test it recently to a fork of the C# blank project which you can find here (only tested on macOS). Perhaps you can use this as a base to unblock you using the C# SDK with .NET Core until we support it fully.

Hope this helps!