6

Closed

Failed Window App Cert Test

description

The Metro build fails the WACT tool test on the latest RC build of Windows 8 and VS Ultimate, with the following errors:
 
◦API System.Reflection.Emit.DynamicMethod in SYSTEM.REFLECTION.EMIT.LIGHTWEIGHT, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.Label in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.LocalBuilder in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.DynamicMethod.#ctor(System.String,System.Type,System.Type[],System.Reflection.Module,System.Boolean) in SYSTEM.REFLECTION.EMIT.LIGHTWEIGHT, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.DynamicMethod.#ctor(System.String,System.Type,System.Type[],System.Type,System.Boolean) in SYSTEM.REFLECTION.EMIT.LIGHTWEIGHT, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.DynamicMethod.GetILGenerator in SYSTEM.REFLECTION.EMIT.LIGHTWEIGHT, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.DefineLabel in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Int32) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Reflection.Emit.Label) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Reflection.ConstructorInfo) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.MarkLabel(System.Reflection.Emit.Label) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.DynamicMethod.set_InitLocals(System.Boolean) in SYSTEM.REFLECTION.EMIT.LIGHTWEIGHT, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.DeclareLocal(System.Type) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Type) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Reflection.FieldInfo) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.Emit.ILGenerator.Emit(System.Reflection.Emit.OpCode,System.Reflection.MethodInfo) in SYSTEM.REFLECTION.EMIT.ILGENERATION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
◦API System.Reflection.TypeInfo.get_Module in SYSTEM.REFLECTION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.
Closed Jun 9, 2012 at 5:17 AM by JamesNK
Fixed

comments

Skyrunner wrote May 18, 2012 at 3:30 PM

I managed to get it working.
Just grab the source code from GitHub then try to compile.
For each error go to the #if englobing the code and add || NETFX_CORE
You should have #if !(SILVERLIGHT || PORTABLE || NETFX_CORE) instead of #if !(SILVERLIGHT || PORTABLE)

If you have compilation error about DictionaryEntry chose the one in the Json.net namespace.
Hope this helps.

JamesNK wrote May 18, 2012 at 10:23 PM

I will fix the WinRT build when the Win8 RC is available, until then modify the source code yourself.

Another option that might work is using the portable library build.

JamesNK wrote May 31, 2012 at 1:59 AM

I excluded anything todo with Reflection.Emit from 4.5.6 which is now available on CodePlex and NuGet.

It might now work - I'd be interested to know.

imkow wrote Jun 1, 2012 at 3:48 AM

With 4.5.6, App Cert Kit reports this:
◦API System.Reflection.TypeInfo.get_Module in SYSTEM.REFLECTION, PUBLICKEYTOKEN=B03F5F7F11D50A3A is not supported for this application type. Newtonsoft.Json.dll calls this API.

imkow wrote Jun 1, 2012 at 3:51 AM

it's built by VS2012 RC on Windows 8 RP

ifioravanti wrote Jun 4, 2012 at 1:24 PM

Thx SkyRunner! It works! App Cert Passed!

ifioravanti wrote Jun 4, 2012 at 1:24 PM

Thx SkyRunner! It works! App Cert Passed!

JamesNK wrote Jun 4, 2012 at 1:25 PM

I have excluded the call to TypeInfo.Module from the latest source code on GitHub. I would be interested to know whether it now passes.

ifioravanti wrote Jun 6, 2012 at 8:18 PM

With changes suggested by SkyRunner AppCert is passed. The problem is that after running AppCert all assembly are compiled in native code and from that moment on JSON.Net JSONConvert method raises the following exception:
System.EntryPointNotFoundException was unhandled
HResult=-2146233053
Message=Entry point was not found.
Source=Newtonsoft.Json
TypeName=""
StackTrace:
   at Newtonsoft.Json.Utilities.ReflectionUtils.GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.GetSerializableMembers(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe(Object value)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)

gregstoll wrote Jun 8, 2012 at 4:53 AM

I was able to get the code from GitHub and build it on Win8 RP (after resolving some ambiguous references to DictionaryEntry's), and it seems to work and it definitely passes the App Cert Kit. Thanks!

ifioravanti wrote Jun 8, 2012 at 10:35 PM

I downloaded latest version from GitHub and AppCert passes but I'm still getting error at runtime: System.EntryPointNotFoundException was unhandled

This happens only after AppCert is used... because all assembly are compiled in Native Code and this causes the issue above :(