Out of memory error when compiling UWP app in release mode with .Net native

风流意气都作罢 提交于 2019-11-30 19:10:18

问题


I have a solution where my main project is a uwp app, and two other projects referenced by the app :

  1. UWP App ---> references 2.
  2. Universal Class library ----> references 3.
  3. PCL Library

2 --> uses EF7 and SQLight.

3 --> uses PCLCrypto

Now, everything works just fine and excellent when I'm on Debug mode x86 targeting local machine.

I want to compile the solution in release mode using .Net native tool chain, here's my config :

When I launch the compilation, it takes a remarkably long time, and too much memory is consumed by the .Net native tools :

After some time, everything stops with 2 errors on visual studio :

Here's what the output window says :

1>------ Build started: Project: ServerCommunication, Configuration: Release Any CPU ------ 1> ServerCommunication -> C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\ServerCommunication\bin\Release\ServerCommunication.dll 2>------ Build started: Project: NewspaperDataLayer, Configuration: Release x86 ------ 2>C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets(225,5): warning : All projects referencing ServerCommunication.csproj must install nuget package Microsoft.Bcl.Build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317569. 2> NewspaperDataLayer -> C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\NewspaperDataLayer\bin\x86\Release\NewspaperDataLayer.dll

3>------ Build started: Project: Liberte, Configuration: Release x86

--some warnings here that I just skipped

3> Starting .NET Native compilation 3> Processing application code 3>C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\Liberte\Resources.System.Linq.Expressions.rd.xml(35): warning : Method 'CreateLambda' within 'System.Linq.Expressions.Expression' could not be found. 3>C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\Liberte\Resources.System.Linq.Expressions.rd.xml(91): warning : Method 'ParameterIsAssignable' within 'System.Linq.Expressions.Expression' could not be found. 3> Computing application closure and generating interop code 3> Generating serialization code 3> Compiling interop code 3> Cleaning up unreferenced code 3> Generating native code 3>STARTPROCESSTASK : error : Out of Memory 3>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(1129,5): error : ILT0005: 'C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\Tools\nutc_driver.exe @"C:\Users\aymen\Documents\Visual Studio 2015\Projects\Applinova\Liberte\Liberte\obj\x86\Release\ilc\intermediate\MDIL\Liberte.rsp"' returned exit code 1 ========== Build: 2 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

What would possibly be wrong with this please ??


回答1:


I had the same problem (I am also using EF7 and other libraries) but I solved using Visual Studio 15 preview (it is not visual studio 2015 update 2, which I didn't try). They improved the .NET native tools so now you should not have any problem, even if using a lot of third party library.

UPDATE

I have solved all my issues after i have installed visual studio 2015 update 3 and switched from EF7 to EF core also available via nuget




回答2:


I have been struggled past few days around trying to fix this problem, but currently there is no easy solution for it.

There is a closed Issue on EF7 github, more info here (https://github.com/aspnet/EntityFramework/issues/4387) where they suggest as solution update EF7 to v1.0.0-rc2-16898.

I didn't manage how to update and as it still a nightly version, my final solution ("fast" workaround) was change my entire DB to sqlite-pcl (https://visualstudiogallery.msdn.microsoft.com/4913e7d5-96c9-4dde-a1a1-69820d615936).

If you aren't in a rush to lunch your application, you can always wait until final version of RC2 it should be done during April.



来源:https://stackoverflow.com/questions/36162610/out-of-memory-error-when-compiling-uwp-app-in-release-mode-with-net-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!