Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

UWP .net Native Internal Compiler Error. #7408

Closed

Description

@danwalmsley

Sorry if this is the wrong place for .net native and UWP compile errors.

I have a UWP app, and we have been using debug mode during develop. We are trying to build in release mode with .net native toolchain (this is quite important for us to get the high performance.)

However we get an internal compiler error:

8>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(3164,5): warning : APPX4001: Build property AppxBundlePlatforms is not explicitly set and is calculated based on currently building architecture. Use 'Create App Package' wizard or edit project file to set it.
8>  Processing application code
8>  Computing application closure and generating interop code
8>    Loading 121 modules...
8>    Generating code...
8>    Interop code generated.
8>  Generating serialization code
8>  Compiling interop code
8>  Generating System.Reflection.DispatchProxy proxy code.
8>  Cleaning up unreferenced code
8>  Generating native code
8>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.3\tools\Microsoft.NetNative.targets(801,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.3\tools\x64\ilc\Tools\nutc_driver.exe @"C:\dev\repos\ILMD\ILMD.App\ILMD.App\ILMD.App.UWP\obj\x64\Release\ilc\intermediate\MDIL\ILMD.App.UWP.rsp"' returned exit code 1
========== Build: 7 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I ran using msbuild and versbose and nutc_driver.exe gives internal compiler error but no more useful information.

I would be willing to send my source code for testing privately.

Thanks in advance

Activity

  1. MichalStrehovsky commented on May 8, 2019

    @MichalStrehovsky
    Member

    Can you try adding <Use64BitCompiler>true</Use64BitCompiler> to a PropertyGroup in your main project? Mysterious nutc_driver crashes are often due to the compiler running out of memory.

    You should be able to verify that it's doing the new thing if you see C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.3\tools\x64\ilc\ Tools64 \nutc_driver.exe running instead of the one from the Tools directory.

  2. danwalmsley commented on May 8, 2019

    @danwalmsley
    Author

    @MichalStrehovsky ok I get a bit further now thanks!

    However now I get

    8>  Generating native code
    8>  Generating fixups for native code
    8>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.3\tools\Microsoft.NetNative.targets(801,5): error : RHBIND : error RHB0002: Failed to write PDB.
    8>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.3\tools\Microsoft.NetNative.targets(801,5): error : ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.3\tools\x64\ilc\Tools\rhbind.exe @"C:\Users\dan\repos\ILMD\ILMD.App\ILMD.App\ILMD.App.UWP\obj\x64\Release\ilc\intermediate\rhbindargs.ILMD.App.UWP.rsp"' returned exit code 2
    ========== Build: 7 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    
    
  3. MichalStrehovsky commented on May 8, 2019

    @MichalStrehovsky
    Member

    Well, at least we know that the problem is that the code is too big. In the Properties folder of your main app project, you'll find a "Default.rd.xml" file - it has this line in it:

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

    Try commenting it out - it tells the compiler to consider all the code in your app used - that's unlikely the case, especially if you use many NuGet packages. If your app builds and works, great, we're done.

    If it builds, but doesn't work, put the line back in and look at the list of assemblies in your app. Try to pick assemblies that are big and are unlikely to be used with reflection and add following lines for them:

    <Assembly Name="AssemblyX" Dynamic="Auto" />
    <Assembly Name="AssemblyY" Dynamic="Auto" />
    <Assembly Name="AssemblyZ" Dynamic="Auto" />

    This makes the *Application* line no longer apply to those assemblies. Hopefully the compiler will be able to remove enough unused code that the app will compile and still work.

  4. danwalmsley commented on May 8, 2019

    @danwalmsley
    Author

    @MichalStrehovsky great just commenting out the *Application line made it compile.

    May I thank you greatly for you excellent support and great work that you are doing on CoreRT.

  5. losbojos commented on May 30, 2019

    @losbojos

    In my case, it did not help to solve the same problem:
    Error ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x86.microsoft.net.native.compiler\2.2.3\tools\x86\ilc\Tools64\nutc_driver.exe @"C:\Install_DIR\bcwipe_tm.git\bcwipe_uwp\bcwipe_uwp\obj\x86\Release\ilc\intermediate\MDIL\bcwipe_uwp.rsp"' returned exit code 1

  6. losbojos commented on May 30, 2019

    @losbojos

    But I solved the problem by increasing the amount of RAM on the virtual machine from 2 to 8 GB

  7. danwalmsley commented on Aug 12, 2019

    @danwalmsley
    Author

    @MichalStrehovsky hi, im reopening this issue because my app has gotten a little bigger now and the

    error : RHBIND : error RHB0002: Failed to write PDB. has come back.

    Iv tried

     <Assembly Name="*Application*" Dynamic="Excluded" />
    
        <!-- Newtonsoft.Json" -->
        <Assembly Name="Newtonsoft.Json" Dynamic="Required All" />
    
        <Assembly Name="ReactiveUI" Dynamic="Required All" />
        <Assembly Name="ReactiveUI.Validation" Dynamic="Required All" />
        <Assembly Name="System.Reactive" Dynamic="Required All" />
    

    Which I assume should be an absolute minimum, but rhbind still runs out of memory and crashed, im using 64bit compiler too.

    This is for a LOB app, win msft store, so id be happy as a solution, to be allowed to deploy the app to the store without .net native compilation, but this doesnt seem possible?

    Any advice is greatly appreciated.

    Dan

  8. Pinox commented on Aug 15, 2019

    @Pinox

    same here. I use Use64BitCompiler>true</Use64BitCompiler and have 32GB RAM on my machine.

    Also running ReactiveUI libs , can't build UWP in release mode anymore. My last working version was using ReactiveUI version 9.13.1

    I have tried the solution from @MichalStrehovsky on my top 20 assemblies in size without success where you use :
    Assembly Name="*Application*" Dynamic="Required All"
    Assembly Name="*Assembly1*" Dynamic="Auto"

    MS please provide some pointers how to proceed.

    error

  9. MichalStrehovsky commented on Aug 16, 2019

    @MichalStrehovsky
    Member

    @Pinox Can you try downgrading Reactive like described here: #7687 (comment)

    If that doesn't help, please email dotnetnative at microsoft dot com - out of all the people who're in charge of servicing .NET Native, I'm the only one who hangs out in this repo and I don't scale well.

  10. simader commented on Sep 23, 2019

    @simader

    Any news on this Issue?
    We want to push our Xamarin.Forms.UWP app (Which is a bit bigger) into the Microsoft Store, and the Release Build is never finishing.

    With uncommenting <Assembly Name="*Application*" Dynamic="Excluded" /> it got build (after 35 Minutes), but crashes immediatly.

    (This comment was edited by @MichalStrehovsky to make inline XML visible)

  11. MichalStrehovsky commented on Sep 23, 2019

    @MichalStrehovsky
    Member

    @simader Can you please reach out to dotnetnative at microsoft dot com by email? It's a better channel to report .NET Native issues and get help.

  12. DevEddy commented on Oct 12, 2019

    @DevEddy

    @simader could you get any new info to this? Same problem.

    Eddy

  13. simader commented on Oct 15, 2019

    @simader

    No, nothing new. We are thinking to throw away our whole UWP project. Because it behaves completely different in Release with ". Net native compilation" than in Debug. And the windows store is forcing us to activate this.

  14. jipjan commented on Oct 15, 2019

    @jipjan

    Have you tried compiling with Visual Studio 2019 16.3.3+.

    The release notes of v16.3.3 contains this fix:

    A fix is made to address a compiler internal error when the code has an out-of-line definition of a static data member of a nested class inside a partial specialization.

    No idea if that's the problem here, but at least worth a try.

  15. premiaware commented on Oct 18, 2019

    @premiaware

    i have the same problem
    C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : RHBIND : error RHB0002: Failed to write PDB.

    After I have added SyncFusion ReportView Control to my App the native compile not working.

    When Microsoft Fix this problem? is possibile in 2019 to loose working days for this problems?

  16. MichalStrehovsky commented on Oct 18, 2019

    @MichalStrehovsky
    Member

    @premiaware Can you please reach out to dotnetnative at microsoft dot com by email? It's the best channel to make sure your problems are heard by the right people. People in charge of servicing .NET Native don't monitor this repo.

  17. DevEddy commented on Dec 2, 2019

    @DevEddy

    If anyone else looking for a solution, found in this comment: https://developercommunity.visualstudio.com/comments/742027/view.html

    For me I needed to add to my csproj:

    <ShortcutGenericAnalysis>true</ShortcutGenericAnalysis>

    and add my used libs to Default.rd.xml

    Greetings,
    Eddy

  18. JKennedy24 commented on Dec 3, 2019

    @JKennedy24

    Hi @DevEddy Can I dig for a bit more info.

    Did you add the <ShortcutGenericAnalysis>true</ShortcutGenericAnalysis> to your App.UWP.csproj? and did you add it to any other csproj files?

    Also when you say

    and add my used libs to Default.rd.xml

    Could you expand upon this, i.e. how did you do this and what did you end up adding? What did your Default.rd.xml end up looking like?

    My default.rd.xml currently fails and looks like:

    <Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
      <Application>
        <!--
          An Assembly element with Name="*Application*" applies to all assemblies in
          the application package. The asterisks are not wildcards.
        -->
        <Assembly Name="*Application*" Dynamic="Required All" />
        <Type Name="FieldStrikeMove.UWP.MainPage" Dynamic="Required All" />
        <Type Name="System.EventHandler" Dynamic="Required All" />
        <!--<Type Name="Microsoft.Extensions.Caching.Memory.MemoryCacheOptions" Dynamic="Required All" />-->
    
        <!-- Add your application specific runtime directives here. -->
    
      </Application>
      <Library Name="Syncfusion.DataSource.Portable">
        <Type Name="System.Linq.EnumerableExecutor{System.Int32}" Dynamic="Required Public" />
        <Type Name="System.Collections.ObjectModel.ObservableCollection{}" Dynamic="Required Public" />
        <Namespace Name="System.Linq" Dynamic="Required All" />
      </Library>
    
    </Directives>
    

    And I read alot about the *Application* line causing this error.

    It would be a great help if you could provide a bit more info

    Thanks

  19. DevEddy commented on Dec 3, 2019

    @DevEddy

    HI @JKennedy24,

    sure, like described in the linked comment I did the following:

    Add ShortcutGenericAnalysis just to the UWP.csproj

    Start from nothing.

    1. Remove the special *Application* directive
    2. Build the app
    3. Test the app and see if you hit any runtime errors
    4. If you do you’ll need to look at the error location and see if adding some directives can help then head back to (2).
    5. If you find no errors, you’re done! Hooray!

    I got my dependencies by inspecting the following folder after previous successful release build: obj\[architecture]\Release\ilc\in

    My Default.rd.xml looks like this: Default.rd.xml.zip

    Greetings,
    Eddy

  20. JKennedy24 commented on Apr 23, 2020

    @JKennedy24

    Ok so I've finally got around to sorting this out and here are some notes:

    1. I dont know why this issue is closed, its not fixed
    2. symptoms are: if you use .net toolchain and devops pipelines to build a large app you will probably hit this error (if I were to guess I would say its a the build machine running out of memory trying to sort dependencies)
    3. to fix the issue it looks like you have to construct the dependencies as DevEddy suggested manually. This doesn't seem very maintainable but is the only workaround provided.

    When I constructed mine I had 310 dependencies I had to manually add, As this was laborious and prone to error I wrote a small console application to create these lines manually. attached below:

    DefaultRDXMLCreator.zip

  21. jkotas commented on Apr 23, 2020

    @jkotas
    Member

    I dont know why this issue is closed

    It is closed because of CoreRT is not the right place to report .NET Native for UWP issues. The right places are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions