question

ed123-7320 avatar image
1 Vote"
ed123-7320 asked ed123-7320 commented

[UWP] Bug report: .Net Native compiler crashing

I am unable to compile UWP application in Release configuration when the following two lines added to the project:

public struct TestStruct { }
public delegate ref TestStruct TestDelegate();


The below is from the Output window:

1>------ Build started: Project: NetNativeCrash, Configuration: Release x64 ------
1> NetNativeCrash -> C:\Projects\NetNativeCrash\bin\x64\Release\NetNativeCrash.exe
1> Processing application code
1> Computing application closure and generating interop code
1> Loading 44 modules...
1> Generating code...
1> Interop code generated.
1> Compiling interop code
1> Generating System.Reflection.DispatchProxy proxy code.
1> Cleaning up unreferenced code
1> Generating native code
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\x64\ilc\Tools\nutc_driver.exe @"C:\Projects\NetNativeCrash\obj\x64\Release\ilc\intermediate\MDIL\NetNativeCrash.rsp"' returned exit code 2
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FayWang-MSFT avatar image
0 Votes"
FayWang-MSFT answered FayWang-MSFT commented

Hello,​

Welcome to our Microsoft Q&A platform!


From this error information, the nutc_driver crashes is often because of the compiler running out of memory. You could find a Properties folder under you project and open the "Default.rd.xml" file. There has the following code:

 < Assembly Name="*Application*" Dynamic="Required All" />

Try to comment it out, this code means the compiler is told to consider all the code in your app used, so it may cause the exception. Then you can build you project again to check it. For more details about this error, you can refer to this thread.


Thanks.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It's not the size because i build blank freshly created UWP project with just these couple of lines added. And if i comment out the suggested line in Default.rd.xml, it will strip off the delegate declaration that is the source of the problem.

0 Votes 0 ·

Hi, as Matt said, this is a bug and can you provide some additional info? Did you find this while developing a new app? Is it part of a larger package you rely on? etc.

0 Votes 0 ·
MatthewWhilden-8692 avatar image
0 Votes"
MatthewWhilden-8692 answered ed123-7320 commented

Hello!

Thanks for the report. This is a bug in the .NET Native optimizer. In particular, it appears to be running in to complications while building up the initial program graph. I've created an issue and assigned it to the appropriate folks to take a look. As this happens so early in that component, I have not found a way to work around the issue. In the mean time I suspect you'll need to avoid this construct.

Some additional info always helps us with triage. Did you find this while developing a new app? Is it part of a larger package you rely on? etc.

Matt
.NET Native Runtime and Compiler team

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Matt, we use this construction to optimize CPU and memory usage in our .net standard library that implements MVVM framework that our UWP app relies on. In particular, it allows us to use 'struct' instead of 'class' for the instances of custom bindable properties that are in hundreds in our app. We tried to workaround this issue and it somewhat works but we now see worse app startup time.

0 Votes 0 ·

Hi Matt, Any news on this problem? It's been a year since i reported this problem and we really could use returned references to struct to make our UWP apps run faster and consume less memory.

0 Votes 0 ·
Joao-3537 avatar image
0 Votes"
Joao-3537 answered

Hi Matt,

I'm facing the same issue when compiling an empty UWP project with the Microsoft.ML.ONNXRuntime dependency and the ".NET Native tool chain" option enabled.

When using UWP 6.2.9 version, the compilation error is : ILT0021: Could not resolve method 'EETypeRva:0x00047188'

With UWP 6.2.10 version: ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\x64\ilc\Tools\nutc_driver.exe @"C:\Src\uwp-sample-app\UWPSampleApp\obj\x64\Debug\ilc\intermediate\MDIL\UWP.Sample.App.rsp"' returned exit code 2

Do you have any updates on this issue? Is this something that must be changed in the ONNXRuntime lib or is it a .NET native issue?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DanielRuse-9570 avatar image
1 Vote"
DanielRuse-9570 answered dinno4-0323 commented

44395-image.png


I have same problem when I try to run the application in release mode
Did someone find an workaround ?


image.png (6.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.