.Net Native is a disaster
Any developer of real-life apps would agree that .Net Native is a disaster after looking at its deficiencies by design.
Real-life experience of app development shows that more than 90% of app problems are related to .Net Native.
- An app may run perfectly in JIT mode but can fail in .Net Native compiled mode. It is often time-consuming to find the culprit.
- An app may run perfectly in JIT mode but cannot be packaged with .Net Native compilation. The remedy could be a wide range of hit-or-miss ad-hoc methods such as
- Clean a project.
- Clean a solution.
- Restart Visual Studio.
- Restart the dev computer.
- Delete the bin and obj folders of the project.
- Run a configuration in release mode first. In other words, if the package building has errors in building the x86 package, run the app in x86 release mode first. This remedy is strange, but anything can happen or be a remedy with the .Net Native nightmare.
- Delete folder C:\Users\userid\.nuget\packages
Since each build takes about 15 minutes, it can easily take 1 or 2 hours to build an app package after addressing one after another issue in the app building.
HockeySDK NuGet packages can cause all kinds of troubles in generating app packages.
- It has made the stack trace largely useless for app problem, especially crash, diagnosis.
- It causes numerous crashes such as the infamous Unknown and application_hang_xxx crashes.
- It takes 35 minutes to build a UWP package as of 2020-01-15
Here is a partial list of the issues encountered in package building:
- error CS0518: Predefined type 'System.String' ('System.Void'), is not defined or imported.
- Solution: delete folders bin and obj of the app project and library projects referenced by the app.
- ...\Microsoft.NetNative.targets(788,5): error : Unhandled Exception: System.InvalidCastException: Specified cast is not valid ...
- Solution: restart VS, then create the app package.
- ...\Microsoft.NetNative.targets(788,5): error : ILT0005: '...h\.nuget\packages\runtime.win10-x86.microsoft.net.native.compiler\2.1.8\tools\x86\ilc\Tools\nutc_driver.exe @"...\AppName\obj\x86\Release\ilc\intermediate\MDIL\AppName.rsp"' returned exit code -1073741819
- Solution: restart VS, then create the app package.
- ...\Microsoft.NetNative.targets(788,5): error MSB6006: "ilc.exe" exited with code -1073741819.
- Solution: 1. clean the solution; 2. Exit VS. 3. delete all folders bin and obj of the app project and all projects referenced by the project.
- error CS1703: Multiple assemblies with equivalent identity have been imported:
- Solution: installing a NuGet package will reset something to remedy this.
- Could not use a link to copy "C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-arm.microsoft.net.native.compiler\2.2.7-rel-27913-00\build\..\tools\Runtime\arm\Microsoft.NET.Native.Runtime.2.2.appx" to "E:\UNO\...\Dependencies\arm\Microsoft.NET.Native.Runtime.2.2.appx". Copying the file instead. The system cannot move the file to a different disk drive. (Exception from HRESULT: 0x80070011)
- Solution: update any NuGet package to disturb the NuGet package pool.