Windows App Certification Kit Fails with error: The type System.Type was not found - All types referenced in metadata files must be discoverable
Windows App Certification Kit Fails with error: The type System.Type was not found - All types referenced in metadata files must be discoverable
我无法通过 App Certification Kit 因为当它运行 Windows 运行时元数据 验证测试时,它创建一组错误消息,所有错误消息都抱怨类型 System.Type:
> The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
> Files\windowsappsb38d4f4.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\windowsappsb38d4f4.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\windowsappsb38d4f4.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\windowsappsb38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable.
ShapefileUniversal 是在 C++/CX 中开发的 Windows 运行时组件类型 FieldInfo 编码如下:
public ref class FieldInfo sealed
{
public:
property Platform::String^ Name;
property Platform::Type^ Type;
property uint8 Size;
};
它引用了 Platform::Type,但使用 dotPeek[ 分析了 .winmd 文件 or ILDasm, 才发现其实是翻译成 [mscorlib]System.Type 下一篇可以看到ILDasm 输出的片段:
.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
分析清单,该组件引用了 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
所以我认为一切都必须是好的。不明白为什么ACK找不到WRC用的System.Type
编译器(Visual Studio2017更新到15.6.6),NuGet包全部更新,在C++/CX项目中,Target Platform Version和Target Platform Min。版本均为 10.0.16299.0,应用程序在调试、发布、win32、x64 下均能正常运行,问题仅出在 WACK 上。
提前致谢。
您需要使用类型 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).
我很惊讶 C++ 编译器没有抱怨在 public 接口中使用该类型;似乎是个错误。
我无法通过 App Certification Kit 因为当它运行 Windows 运行时元数据 验证测试时,它创建一组错误消息,所有错误消息都抱怨类型 System.Type:
> The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
> Files\windowsappsb38d4f4.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\windowsappsb38d4f4.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\windowsappsb38d4f4.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\windowsappsb38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable.
ShapefileUniversal 是在 C++/CX 中开发的 Windows 运行时组件类型 FieldInfo 编码如下:
public ref class FieldInfo sealed
{
public:
property Platform::String^ Name;
property Platform::Type^ Type;
property uint8 Size;
};
它引用了 Platform::Type,但使用 dotPeek[ 分析了 .winmd 文件 or ILDasm, 才发现其实是翻译成 [mscorlib]System.Type 下一篇可以看到ILDasm 输出的片段:
.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
分析清单,该组件引用了 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
所以我认为一切都必须是好的。不明白为什么ACK找不到WRC用的System.Type
编译器(Visual Studio2017更新到15.6.6),NuGet包全部更新,在C++/CX项目中,Target Platform Version和Target Platform Min。版本均为 10.0.16299.0,应用程序在调试、发布、win32、x64 下均能正常运行,问题仅出在 WACK 上。
提前致谢。
您需要使用类型 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).
我很惊讶 C++ 编译器没有抱怨在 public 接口中使用该类型;似乎是个错误。