ResourceMap Not Found Exception message

I blogged previously about the difference when accessing Resources within a .net for Windows Store app as compared with a classic .Net application.

Recently I included a 3rd party assembly into my app and received the exception:

‘ResourceMap Not Found’

This indicates that a request for a particular resource has failed because it cannot find it. It would be nice if the error message told you which resource it was unable to find. However, In my case it was due to the 3rd party library using String resources that it could not find.

To debug this I took a look at the resource file that the app was using.   This is found in the \bin\debug\ folder of the app and is named ‘resources.pri’. This file is a binary and you cannot read it directly. Instead you must use the command line tool ‘makepri.exe’  to dump a human readable version of the file.

  1. Open developer command line
  2. Navigate to the ‘~\project\bin\debug\’ folder
  3. Run the command ‘makepri.exe dump’

This will output an xml version of the resources used by an application – including any that were associated with my 3rd party assembly. 

Effectively all resources (including 3rd party) should be merged into this one file when compiling. However to do the merge the 3rd party resources need to be available; and located relative to the 3rd party assembly (or in the bin folder). if the compiler does not find them then they do not get merged into the resources.pri and your app breaks at run-time.

  • So check that you have the .pri files for 3rd party assemblies and that you have put on disk alongside the referenced assembly (.dll).  The .pri file should be the same name as the assembly. So for instance, if you reference an assembly called ‘Prism.dll’ then you should have a ‘Prism.pri’ in the same folder as it.

Technorati Tags: Winrt