Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Implement the latest .NET runtime #1287

Closed
Kevenvz opened this issue Feb 7, 2022 · 7 comments
Closed

Feature request: Implement the latest .NET runtime #1287

Kevenvz opened this issue Feb 7, 2022 · 7 comments

Comments

@Kevenvz
Copy link

Kevenvz commented Feb 7, 2022

Couldn't really find a feature request issue template

Hey,

Recently FiveM really started my interest, found out that most of the resources are written in Lua whilest there is support for C# and JavaScript. I couldn't really understand why tho, I thought most people would create their resources using Javascript (since the node ecosystem is huge).

My question aside, I started investigating the .NET implementation of FiveM and saw that it was using Mono. Don't really know exactly how old FiveM is but that just seems logical since .NET framework is not cross platform and .NET Core was still in development. Recently Microsoft really polished .NET Core and just ditched the name Core and named it .NET 5/6 (5 is the 'it works' version, 6 is the really polished version).

So here is my feature request, it would be amazing to have proper support for the latest .NET runtime. This would create many more opportunities and (hopefully) a lot more .NET developers will enjoy creating resources in FiveM.

I've heard that Unity is currently also moving from Mono to the latest .NET Core runtime, so it would be logical if this will happen to FiveM as well.

I'd like to hear your thoughts!

@blattersturm
Copy link
Contributor

blattersturm commented Feb 7, 2022

Since you're new, I guess you may not understand the constraints we're having to work with. I'll take out one relevant part from your message and reply to that, since it applies to most of the remainder of the original post as well.

I've heard that Unity is currently also moving from Mono to the latest .NET Core runtime, so it would be logical if this will happen to FiveM as well.

Why is this 'logical'?

  1. Unity isn't a platform running untrusted user code on client systems. We are. 'CoreCLR' removed all functionality allowing for this sandboxing, and newer Mono versions would require a lot of work to get this working for zero user advantage other than 'it's newer' as it'd still expose the same API set if we'd just forward-port the current logic for sandboxing.
  2. Mono is part of 'the latest .NET Core runtime': https://github.com/dotnet/runtime/tree/main/src/mono - CoreCLR and Mono are the two runtimes available to such, because even Microsoft acknowledges that the CoreCLR codebase (evolved from the old .NET runtime as of ~1999) isn't suited for all the environments Mono is. In fact, .NET 6's 'sandboxed' WASM runtime uses Mono. It's also a bit too slow for our use cases and doesn't support JIT yet so we can't trivially adopt that either.

Most of your request seems to be based on 'it's new so it's good' and somehow assuming 'Mono' is not 'the latest .NET runtime', without stating practical reasons why you'd want this other than vague things like 'it being amazing' and 'creating many more opportunities'.

Finally, since this is not an actionable request, I'll be closing this. I'll leave this unlocked for discussion, but ideally discussions would go on the forums: https://forum.cfx.re/

@Kevenvz
Copy link
Author

Kevenvz commented Feb 7, 2022

Wasn't really my intention to create an issue that came across "'it's so simple, everyone's doing it!'". Just wanted to start the conversation of a possibility of implementing CoreCLR.

Thanks for the edits on the comment, I completely forgot that you guys need to run in a sandboxed environment. The real reason I started creating this issue is for the support for .NET Standard 2.1 (Mono 6.4+) haven't really searched if the support is there already.

@blattersturm
Copy link
Contributor

Nope, and netstandard2.1 is a bit of a way-behind target as well given net5.0 etc. supersede it. We're stuck on I believe 5.16 or 5.18 at this time as newer versions led to some memory corruption bug that was hard to diagnose. It may be fixed since, but nobody has had time to try yet.

@Kevenvz
Copy link
Author

Kevenvz commented Feb 7, 2022

Understood, thanks for the explanation.

@blattersturm
Copy link
Contributor

Also, if you just want to achieve goal X (in this case, 'using netstandard2.1 libraries on server'), don't post a request asking about everything ever except goal X. It's really annoying.

@michaelcerne
Copy link

Could anyone provide additional information on the memory corruption issue listed above?

I'm having trouble finding any references.

@Twinki14
Copy link

Twinki14 commented Dec 27, 2023

  1. Mono is part of 'the latest .NET Core runtime': https://github.com/dotnet/runtime/tree/main/src/mono - CoreCLR and Mono are the two runtimes available to such, because even Microsoft acknowledges that the CoreCLR codebase (evolved from the old .NET runtime as of ~1999) isn't suited for all the environments Mono is. In fact, .NET 6's 'sandboxed' WASM runtime uses Mono. It's also a bit too slow for our use cases and doesn't support JIT yet so we can't trivially adopt that either.

It's been nearly two years since this reply, but we've had .NET 7 and .NET 8 released since. Would this library, written by someone on the dotnet team, be of any use for FiveM https://github.com/SteveSandersonMS/DotNetIsolator. Might allow you to do your sandboxing without needing to use mono.

Furthermore I started a discussion on this here: #2318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants