2

I am using a Winmd (Windows Runtime Component) in a windows store app. When I try to instantiate a type that is defined the in the winmd, I get the following exception:

 System.TypeLoadException was unhandled by user code
  HResult=-2146233054
  Message=Requested Windows Runtime type 'SmartTech.BrokeredProxy.EnterpriseServer' is not   registered.
  Source=mscorlib
  TypeName=SmartTech.BrokeredProxy.EnterpriseServer
    InnerException: System.Runtime.InteropServices.COMException
       HResult=-2147221164
       Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
       ErrorCode=-2147221164
       InnerException: 

I added all references that I need and I made the appropriate changes in the Manifest file . Did I miss something? Any one has an idea what causes this?

Timores
  • 14,439
  • 3
  • 46
  • 46
  • This happens when you use the .winmd file for the component to compile your program but forget to package it along with your other files. A Store app must include **all** of the runtime components it uses. – Hans Passant May 13 '14 at 22:23
  • Finally could you solve this? – Fran_gg7 May 04 '15 at 16:18
  • @HansPassant It appears the OP is using a [brokered runtime component](https://msdn.microsoft.com/en-us/windows/uwp/winrt-components/brokered-windows-runtime-components-for-side-loaded-windows-store-apps) given the `BrokeredProxy.EnterpriseServer'. Thus the app should be sideloaded. – ZX9 Oct 18 '16 at 12:07

1 Answers1

0

for non-winrt apps, i know this error normally points to the component not being registered. i.e. regsvr32 "path of the component"

but for a win 8 app, not sure it is completely applicable.

The other case, i have hit similar issues is due to 32 bit/any cpu conflicts.

the component might be a 32 bit component and Visual Studio might be compiling with the 'Any CPU' setting. Try changing the 'Target CPU' to x86 from project properties and see if the issue occurs.

Project -> Properties -> Build tab -> Platform Target -> Any CPU to x86

Raja Nadar
  • 9,409
  • 2
  • 32
  • 41
  • Also, you can check the specific target cpu for each project in your solution by right-clicking on your solution in Solution Explorer -> **Properties**-> **Configuration Properties**-> **Configuration** – ZX9 Oct 18 '16 at 12:13