none
Test runs and "The process has no package identity" exception is thrown

    Question

  •    

    I have a problem running a test when referencing a metro style app.  When I run the test I get -

    System.InvalidOperationException
    The process has no package identity. (Exception from HRESULT: 0x80073D54)
       at Windows.ApplicationModel.Resources.ResourceLoader..ctor()

    This is similar to the problem outlined in http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/15d98c5b-2aaf-4ecf-9d62-120b91a22966/ where hamling-ling was also getting the error "The process has no package identity." when attempting to run his test from the command line.

    But in my case I am trying to run an NUnit test from within a Resharper test window.  I know that NUNit and Resharper are not Microsoft products - but the "The process has no package identity." exception has to do with these requirements around certificates and I was hoping someone would help me.

    So similar to hamling-ling -

    1) I have a class library (A.dll) that accesses a resw file.
    2) I also have a test project (produces TestA.dll) to test the A.dll.

    The exception is occurring on the constructor of the ResourceLoader() -
      private ResourceLoader _resourceLoader = new ResourceLoader();

    I tried creating the store package 
    (right-click on the test project > Store > Create App Packages... > Local)

    Then running certutil on the MYCOMPANY.Tests_1.0.0.0_AnyCPU.cer certificate file that was created in the package -

    certutil -addstore root C:\lsl\ehuna\MYTEAM\Dev\Source\Tests\MYCOMPANY.Tests\AppPackages\MYCOMPANY.Tests_1.0.0.0_AnyCPU_Test\MYCOMPANY.Tests_1.0.0.0_AnyCPU.cer

    but that did not help.

    Does anyone know what I need to do to get this working?

    I'm using -
      Windows 8 Pro
      Visual Studio 2012 Ultimate
      NUnit 2.6.1
      Resharper 7.1

    Wednesday, October 03, 2012 12:34 AM

Answers

  • "The process has no package identity." exception has to do with these requirements around certificates and I was hoping someone would help me.

    Actually, no. It means the "application" isn't activated properly. ResourceLoader's constructor you're calling is expecting to be call in an application, i.e. in a process with package identity. If it's expecting that and you call it in a desktop process (which lacks package identity), you'll get this error.

    certutil is irrelevant here. You mention A.dll and TestA.dll - what's the *process* calling into this code? Sounds like it's a desktop app and not a Windows store app (i.e. it's not an application properly activated, and thus the process lacks package identity).

    >I am trying to run an NUnit test from within a Resharper test window.

    Sounds like this is just function calling into the code and not actually calling it in an actual Windows store app process space. You'll want to check with Resharper and NUnit and find out what (if any) support for they have for Windows store apps. They're not just plain old processes like notepad.exe created via CreateProcess().


    The architect must be a prophet...a prophet in the true sense of the term...if he can't see at least ten years ahead don't call him an architect - Frank Lloyd Wright Howard Kapustein [MSFT] -- Looking for the Spike... [http://blogs.msdn.com/b/howardk/]

    Monday, October 08, 2012 3:46 AM