Error when building uwp app in Release mode
<p>I have this app, that builds and runs successfully in Debug mode, on both my local computer and on my Windows Phone device, when trying with the Release mode, I get these 3 errors :</p>

<blockquote>
  <p>Error     Internal compiler error: One or more errors occurred.</p>
  
  <p>The non-generic type 'PInvoke.NTSTATUS.Code__PInvoke_Windows_Core'
  cannot be used with type arguments
  ...obj\x64\Release\ilc\intermediate\Liberte.Windows.Interop\SafeTypes.g.cs    333</p>
  
  <p>The type or namespace name 'Value' could not be found (are you missing
  a using directive or an assembly
  reference?)   ...obj\x64\Release\ilc\intermediate\Liberte.Windows.Interop\SafeTypes.g.cs  333</p>
</blockquote>

<p>The actual code where the two last errors are detected is an auto generated code under a file named <code>SafeTypes.g.cs</code> and the line where the errors is raised is :</p>

<pre><code>namespace PInvoke
{
    [global::System.Runtime.InteropServices.McgRedirectedType("PInvoke.NTSTATUS,PInvoke.Windows.Core, Version=0.1.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a")]
    public unsafe partial struct NTSTATUS__PInvoke_Windows_Core
    {
        public global::PInvoke.NTSTATUS.Code__PInvoke_Windows_Core &lt;Value&gt;k__BackingField;
    }
}
</code></pre>

<p>I don't have any idea what does this mean, nor what should I do, any explanation and solution to this ?</p>

<p><strong>Update :</strong></p>

<p>Tried to Close VS, then Delete the Obj and the Bin content, rebuild again, but stuill have the same error.</p>

<p>I should mention maybe that I have reference to 2 other projects, one of them is a PCL project that uses PCLCrypto library, and the other one is a Universal App library that uses EntityFramework 7 pre-release with sqlight.</p>

<p><strong>Update 2:</strong></p>

<p>I tried to disable compilation with .Net native just to see what goes on, the release build succeeds, but the App crashes and quits just after startup.</p>

<p><strong>Update 3:</strong></p>

<p>I just discovered that the <code>PCLCrypto</code> library that I use in one of the two project I'm referencing, references two libs that are causing the problem, and they are mentioned in the errors above, I found this out when trying to uninstall the library to see if it is the cause of the problem :</p>

<p><a href="https://i.stack.imgur.com/cVTOw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cVTOw.jpg" alt="enter image description here"></a></p>

<p>I tried to rollback to a previous stable version, compiled in Debug mode, everything worked perfectly, when I try again Release mode with .Net native, I encounter a new <a href="https://stackoverflow.com/questions/36162610/out-of-memory-error-when-compiling-uwp-app-in-release-mode-with-net-native">problem</a> : <code>Out of memory</code>.</p>