dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.12k stars 4.42k forks source link

does coreclr support ios platform? #100055

Open newNcy opened 1 month ago

huoyaoyuan commented 1 month ago

The ordinal coreclr runtime requires JIT and won't be available on iOS-like platforms.

There are coreclr-compatible Mono runtime in this repo supporting iOS. The NativeAOT variant of coreclr also starts experimental support for iOS. The .NET Core platform supports iOS.

newNcy commented 1 month ago

我的场景是ios上 c++引擎嵌入c#运行时,不过还在调研,基本需求是 -多个实例 -热更新 -导入导出c++接口 试了下mono发现不能多个实例,才想看看coreclr, 有推荐的吗

huoyaoyuan commented 1 month ago

目前所有CLR实现都不支持单进程内多个实例,AssemblyLoadContext可能可以部分满足需求。 NativeAOT是不会支持热更新的,只有启用解释器的Mono可能可以,但是是否启用了相关API也不确定。

newNcy commented 1 month ago

目前所有CLR实现都不支持单进程内多个实例,AssemblyLoadContext可能可以部分满足需求。 NativeAOT是不会支持热更新的,只有启用解释器的Mono可能可以,但是是否启用了相关API也不确定。

mono试了可以热更,不过对alc支持不完善,基本不可用感觉 https://github.com/dotnet/runtime/issues/79711

newNcy commented 1 month ago

还有别的办法能实现 B C两个DLL都引用了A DLL,但是互相隔离的嘛 哪怕是静态变量这种

srxqds commented 1 month ago

mono的alc是不行的,要自己改虚拟机,mono的开发比较坑

srxqds commented 1 month ago

@huoyaoyuan 我一直跟进mono的嵌入开发5年多了,坑特别多,有没有什么渠道可以反馈下,让官方重视下吗?

newNcy commented 1 month ago

mono的alc是不行的,要自己改虚拟机,mono的开发比较坑

不能并行的话有没有前一个用了清理一下重新加载的方法

srxqds commented 1 month ago

不能,bug很多

newNcy commented 1 month ago

不能,bug很多

好吧 谢谢

huoyaoyuan commented 1 month ago

我一直跟进mono的嵌入开发5年多了,坑特别多,有没有什么渠道可以反馈下,让官方重视下吗?

Mono部分人手不多,代码结构也区别很大。我个人没有深入研究过Mono代码,不好断言工作量多大,但不排除巨坑的可能。 目前阶段官方对Android/iOS的工作主要是把CoreCLR的NativeAOT适配过去。

srxqds commented 1 month ago

像这种必现的问题:https://github.com/dotnet/runtime/issues/98805 官方也没有动力去修复,都是懒得去验证

am11 commented 1 month ago

Not yet: https://github.com/dotnet/runtime/pull/98127

newNcy commented 1 month ago

不能,bug很多

话说你们后面换方案了吗,发现很多我们关心的问题都是你提的

huoyaoyuan commented 1 month ago

Not yet: #98127

@am11 yeah I've seen the PR and missed it. However, the coreclr interpreter is much more broken then mono intepreter. Do you know if anyone is interested to bring dynamic features to coreclr/iOS? What's the status of NativeAOT-Mint experiment?

am11 commented 1 month ago

What's the status of NativeAOT-Mint experiment?

I think @lambdageek, @ivanpovazan maybe able to answer this. It seems like interest is building up with the increase in NativeAOT usage. :)

srxqds commented 1 month ago

不能,bug很多

话说你们后面换方案了吗,发现很多我们关心的问题都是你提的

没,我们自己修的,最近在升级8.0又是坑无穷无尽

newNcy commented 1 month ago

不能,bug很多

话说你们后面换方案了吗,发现很多我们关心的问题都是你提的

没,我们自己修的,最近在升级8.0又是坑无穷无尽

看了下有mono_close_assembly这个api, 这个也不能卸载吗 直接崩溃了

srxqds commented 1 month ago

不能,bug很多

话说你们后面换方案了吗,发现很多我们关心的问题都是你提的

没,我们自己修的,最近在升级8.0又是坑无穷无尽

看了下有mono_close_assembly这个api, 这个也不能卸载吗 直接崩溃了

这个思路就别想了,现在严格来说没有主动卸载程序集的办法,alc都是基于gc被动的,也经常会出问题

newNcy commented 1 month ago

不能,bug很多

话说你们后面换方案了吗,发现很多我们关心的问题都是你提的

没,我们自己修的,最近在升级8.0又是坑无穷无尽

看了下有mono_close_assembly这个api, 这个也不能卸载吗 直接崩溃了

这个思路就别想了,现在严格来说没有主动卸载程序集的办法,alc都是基于gc被动的,也经常会出问题

好家伙,那就是这个嵌入mono的进程只能是一次性的了

srxqds commented 1 month ago

@newNcy 感受下他们的bug: https://github.com/dotnet/runtime/issues/100065 总而言之,官方没有实际用过的,即使他们说的是支持的,也不能信任

newNcy commented 1 month ago

@newNcy 感受下他们的bug: #100065 总而言之,官方没有实际用过的,即使他们说的是支持的,也不能信任

阿这,我mono用alc.Unload() 静态容器里的东西也没清理掉 难绷

srxqds commented 1 month ago

你可以理解为他们这个完全没实现就行了,是完全 因为他们把collectiable直接设置为false了

filipnavara commented 1 month ago

Not yet: #98127

Notably, that is support strictly for the iOS Simulator. It is not meant to handle anything else. It is purely a way to have faster debug loop for apps that you intend to run with NativeAOT. The JIT restrictions for dynamic code still apply to device deployments and hence CoreCLR cannot be used there.

lambdageek commented 1 month ago

What's the status of NativeAOT-Mint experiment?

I think @lambdageek, @ivanpovazan maybe able to answer this. It seems like interest is building up with the increase in NativeAOT usage. :)

NativeAOT-Mint was a quick hackathon experiment designed to answer the question: "Is it possible to retarget the Mono Interpreter on top of another .NET runtime, or is it too dependent on Mono's underlying implementation." The answer from the experiment was "yes, it is possible, but NativeAOT is not the right runtime - the amount of work to make NativeAOT support dynamic code execution is too great". So what about Mint in CoreCLR? That's an interesting future experiment. At this time there are no plans, but it's something we've thought about.

newNcy commented 1 month ago

你可以理解为他们这个完全没实现就行了,是完全 因为他们把collectiable直接设置为false了

这个作用范围是整个alc吗

srxqds commented 1 month ago

你可以理解为他们这个完全没实现就行了,是完全 因为他们把collectiable直接设置为false了

这个作用范围是整个alc吗

对,就是内部直接设置了false,即使脚本设置为true

newNcy commented 1 month ago

你可以理解为他们这个完全没实现就行了,是完全 因为他们把collectiable直接设置为false了

这个作用范围是整个alc吗

对,就是内部直接设置了false,即使脚本设置为true

确实,临时变量都没gc,估计有bug就直接false了

newNcy commented 1 month ago

目前所有CLR实现都不支持单进程内多个实例,AssemblyLoadContext可能可以部分满足需求。 NativeAOT是不会支持热更新的,只有启用解释器的Mono可能可以,但是是否启用了相关API也不确定。

还有别的clr可选嘛

huoyaoyuan commented 1 month ago

目前所有CLR实现都不支持单进程内多个实例,AssemblyLoadContext可能可以部分满足需求。 NativeAOT是不会支持热更新的,只有启用解释器的Mono可能可以,但是是否启用了相关API也不确定。

还有别的clr可选嘛

.NET Framework,.NET Core的实现都是如此

newNcy commented 1 month ago

coreclr没有解释模式吗

huoyaoyuan commented 1 month ago

coreclr没有解释模式吗

目前处于无人维护的状态,仅限入门级程序可以跑通。mono的解释器一直都有维护,Mint的试验是将其对接到coreclr或NativeAOT上。

newNcy commented 1 month ago

coreclr没有解释模式吗

目前处于无人维护的状态,仅限入门级程序可以跑通。mono的解释器一直都有维护,Mint的试验是将其对接到coreclr或NativeAOT上。

说起来mono aot跟native aot的区别主要在哪,native代码的多少吗