2

We are using the Lumia.Imaging.SDK 2.0 in a Windows Phone 8.1 Runtime app. For some reason, Microsoft failed to set the ActivatableAttribute on the Lumia.Imaging.RandomAccessStreamImageSource class. Consequently, this class does not get marked as an ActivatableClass in the appxmanifest.xml. Of course, trying to instantiate this class leads to the following error.

A first chance exception of type 'System.TypeLoadException' occurred in MyApp.exe Requested Windows Runtime type 'Lumia.Imaging.RandomAccessStreamImageSource' is not registered.

Does anyone know how I can register this class as activatable from C# at run time? Or, is there a way to "hack" the Lumia.Imaging.winmd to include the ActivatableAttribute?

Thanks for your help.

Gyle Iverson
  • 661
  • 1
  • 9
  • 17

2 Answers2

2

I had the same problem. Here is working solution. Add these lines to the Package.appxmanifest manually (use any text editor):

  <Extensions>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>Lumia.Imaging.dll</Path>
        <ActivatableClass ActivatableClassId="Lumia.Imaging.RandomAccessStreamImageSource" ThreadingModel="both" />
      </InProcessServer>
    </Extension>
  </Extensions>

before

</Package>

Make sure that your main (executable) library has reference on Lumia.Imaging.dll

RavingDev
  • 2,817
  • 1
  • 17
  • 19
  • Thanks for the solution. Are there docs that describe this trick? Thanks again! – Gyle Iverson Jan 20 '15 at 11:38
  • Which version of Visual Studio (and update) are you using? Also, are you by chance using the Advertising SDK as well? – CÅdahl Mar 09 '15 at 08:14
  • I use Visual Studio Ultimate 2013 Version 12.0.31101.00 Update 4. Also Microsoft Advertising SDK for Windows Phone installed in Visual Studio, but not used in that solution. – RavingDev Mar 09 '15 at 09:31
0

Make sure you have the latest version. I downloaded the Quickstart from MSDN and it works perfectly on both Phone and Desktop Windows (you have to update the Lumia NuGet package from 2.0.178-alpha to 2.0.184 though).

The sample code uses RandomAccessStreamImageSource without issue (verified by stepping over that line of code in the debugger).

Peter Torr - MSFT
  • 11,824
  • 3
  • 18
  • 51
  • I had a Microsoft development engineer give me a similar answer. While the Quickstart project registers the class correctly, it doesn't solve the problem why my project and BlueRay's project didn't register the class. – Gyle Iverson Jan 20 '15 at 12:15
  • Have you verified that Lumia.Imaging.winmd actually lacks the attribute? I have seen an issue with certain VS2013 versions where it fails to add the entries to Package.appxmanifest. It should also happen with other native WinRT libraries. – CÅdahl Mar 09 '15 at 08:16
  • There may also be a problem with the Advertisement SDK. I'm taking this from memory, but it might be worth checking. – CÅdahl Mar 09 '15 at 08:18