0
votes

I can't pass the App Certification Kit because when it runs the Windows Runtime metadata validation test, it creates a set of error messages, all of them complaining about the type System.Type:

> The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
>     Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable.

ShapefileUniversal is a Windows Runtime Component developed in C++/CX and the type FieldInfo is coded like this:

public ref class FieldInfo sealed
{
public:
    property Platform::String^ Name;
    property Platform::Type^ Type;
    property uint8 Size;
};

It has a reference to Platform::Type, but analyzing the the .winmd file with dotPeek or ILDasm, I realized that it is actually translated to [mscorlib]System.Type as you can see in the next snippet from the ILDasm's output:

.property instance class [mscorlib]System.Type
        Type()
{
  .set instance void ShapefileUniversal.FieldInfo::set_Type(class [mscorlib]System.Type)
  .get instance class [mscorlib]System.Type ShapefileUniversal.FieldInfo::get_Type()
} // end of property FieldInfo::Type

Analyzing the manifest, the component has a reference to mscorlib:

.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 255:255:255:255
}
.assembly windowsruntime ShapefileUniversal
{
  .hash algorithm 0x00008004
  .ver 255:255:255:255
}
.module ShapefileUniversal.winmd
// MVID: {F9F10CFE-F163-4405-8B7F-AEFF3EE1DD60}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x07430000

So I think everything must be OK. I don't understand why ACK can't found the System.Type used in the WRC.

The compiler (Visual Studio 2017 is updated to 15.6.6), the NuGet packages are all updated, in the C++/CX project, the Target Platform Version and Target Platform Min. Version are both 10.0.16299.0 and the app runs correctly in debug, release, win32, x64, the problem is only with the WACK.

Thanks in advance.

1

1 Answers

1
votes

You need to use the type Windows::UI::Xaml::Interop::TypeName as noted in MSDN:

TypeName is the language-neutral Windows Runtime struct for representing type information. Platform::Type is specific to C++ and can't be passed across the application binary interface (ABI).

I'm surprised that the C++ compiler didn't complain about the use of that type in a public interface; seems like a bug.