Cryptic Build Failure in Release Mode for Universal Windows Platform Application

We’ve just managed to solve an issue that’s been plaguing us for a while when we attempt to do a Release build (either via the Store –> Create App Package, or just by setting the build configuration to Release) we were seeing an error message similar to:

RHBIND : error RHB0011: Internal error: 'declModule == m_pLoaderModule'

This error makes no sense, and there’s nothing at all helpful to go on from any of the usual logs etc. A quick search only returned two links, one of which was to a GitHub thread (https://github.com/dotnet/core/blob/master/Documentation/ilcRepro.md) posted by Microsoft that talks about capturing a .NET Native Repro…. not quite what I was interested in. However, further down the post there’s a section entitled “Compilation Failure on Update 1” which lists almost exactly the error we were seeing. The section refers to a new feature called SharedLibrary but doesn’t really talk about how to turn it on or off. It does however link to another post https://blogs.msdn.microsoft.com/dotnet/2015/09/28/whats-new-for-net-and-uwp-in-win10-tools-1-1/.

Initially I didn’t think that there was anything relevant in the post, since it was entitled “What’s new for .NET and UWP in Win10 Tools 1.1” and starts off talking about app-locally and shared appx framework packages. It then talks about how to enable this feature….but in the other post it said that SharedLibrary was on by default…. Anyhow, instead of following this post and setting the UseDotNetNativeSharedAssemblyFrameworkPackage to true (ie enabling it), I figured I’d try setting it to false (ie <UseDotNetNativeSharedAssemblyFrameworkPackage>true</UseDotNetNativeSharedAssemblyFrameworkPackage>). For example the Release section of the UWP project file now looks like:

<PropertyGroup Condition=”‘$(Configuration)|$(Platform)’ == ‘Release|x86′”>
  <OutputPath>binx86Release</OutputPath>
  <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
  <Optimize>true</Optimize>
  <NoWarn>;2008</NoWarn>
  <DebugType>pdbonly</DebugType>
  <PlatformTarget>x86</PlatformTarget>
  <UseVSHostingProcess>false</UseVSHostingProcess>
  <ErrorReport>prompt</ErrorReport>
  <Prefer32Bit>true</Prefer32Bit>
  <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<UseDotNetNativeSharedAssemblyFrameworkPackage>false</UseDotNetNativeSharedAssemblyFrameworkPackage>
</PropertyGroup>

Doing this fixed the Release build for this application and allows us to create a package ready for Store deployment. Hope this helps others.

Leave a comment