0

ここの投稿と同様のエラーが発生します。

彼と同じように、バックグラウンドスレッドでJSONとJSON.NETを解析しています。散発的に失敗し、のエラーが発生しArray.Copyます。

スタックトレースは次のとおりです。

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00104] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Array.cs:979 
  at System.Collections.ArrayList.CopyTo (Int32 index, System.Array array, Int32 arrayIndex, Int32 count) [0x0002d] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3064 
  at System.Collections.ArrayList.CopyTo (System.Array array, Int32 arrayIndex) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections/ArrayList.cs:3046 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x0026c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:259 
  at System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00011] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/MonoType.cs:582 
  at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes[JsonConverterAttribute] (ICustomAttributeProvider attributeProvider, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttribute[JsonConverterAttribute] (ICustomAttributeProvider attributeProvider, Boolean inherit) [0x00000] in <filename unknown>:0 
  ... Continues ...

JSON.Netの問題のあるコードは次のとおりです。

#if !(NETFX_CORE)
    public static T[] GetAttributes<T>(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute
    {
      ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider");

      object provider;

#if !PORTABLE
      provider = attributeProvider;
#else

...  omitted junk ...

      if (provider is Type)
        return (T[])((Type)provider).GetCustomAttributes(typeof(T), inherit);

GetCustomAttributesnullを返していると思います。Xamarinの誰かがこの問題に気づいていますか?ニュースグループの男は、この作業をメインスレッドに配置し、修正したと述べました(ただし、それを実行したいかどうかはわかりません)。

4

1 に答える 1

2

これは既知のバグです。

5.3.3アルファリリースで修正されています。

于 2012-06-04T21:01:46.433 に答える