Avoid .NET Native bugs

浪子不回头ぞ 提交于 2019-12-05 20:00:24

That might be a bug on the .NET Native tool chain...

From my tests, Array.Copy works as expected:

var array1 = new int[1, 1];
var array2 = new int[1, 1];
Array.Copy(array1, array2, array1.Length);
array2[0, 0] = 666;

if (array1[0, 0] != array2[0, 0])
{
    ApplicationView.GetForCurrentView().Title = "OK.";
}
else
{
    ApplicationView.GetForCurrentView().Title = "Bug.";
}

.NET Native dev here - sorry for the trouble you've encountered. As you said, the problem you hit with Array.Clone has been fixed (inadvertently - as a side effect of a different fix) with .NET Native 1.6 and we will be happy to fix any other issues you've encountered.

In order to bring .NET Native, we had to pretty much rewrite all of the CLR (with 15+ years of bug fixes in it). We are in the v1 stage and you're simply more likely to hit a bug in .NET Native than you are in the CLR. Most people don't encounter any bugs on either platform though. As a result of using .NET Native, Windows users can enjoy 30-60% improvements in startup time in all UWP apps (compared to CLR). It might not matter a lot on your development machine, but it matters a lot for the user experience on cheap tablets. We don't currently offer turning .NET Native off as an option.

I filed an issue to improve our test coverage for Array.Clone so that this doesn't happen again (especially because we didn't even know it was broken).

If you hit an issue in the future:

  • You can contact the dev team directly at dotnetnative (at microsoft com)
  • You can submit a fix. .NET Native for UWP apps overlaps greatly with CoreRT repo on GitHub and a lot of the code is shared.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!