Exception when returning an object array of object arry in addin

Last post 02-25-2008, 9:21 AM by Thorsten Uthke. 0 replies.
Sort Posts: Previous Next
  •  02-25-2008, 9:21 AM 903

    Exception when returning an object array of object arry in addin

    Hi,

    I try to return an object array of object array as method result from an addin. The objects inside the array are strings and integers, no custom objects. Unfortunately I get the following exception:

    System.ArgumentException occurred
      Message="Eine Ausnahme vom Typ System.ArgumentException wurde ausgelöst.\r\nParametername: typeToReturn"
      Source="Microsoft.VisualStudio.Tools.Applications.Adapter"
      ParamName="typeToReturn"
      StackTrace:
           bei Microsoft.VisualStudio.Tools.Applications.SerializableObjectContractFormatter.DeserializeArray(ISerializableObjectContract deserialize, SerializableObjectData data, Type typeToReturn, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.SerializableObjectContractFormatter.Deserialize(ISerializableObjectContract deserialize, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.DeserializeToObject(ISerializableObjectContract contract, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.ObjectFromContractRemoteArgument(RemoteArgument remoteArg, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.ObjectFromRemoteArgument(RemoteArgument remoteArg, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.SerializableObjectContractFormatter.DeserializeArray(ISerializableObjectContract deserialize, SerializableObjectData data, Type typeToReturn, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.SerializableObjectContractFormatter.Deserialize(ISerializableObjectContract deserialize, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.DeserializeToObject(ISerializableObjectContract contract, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.ObjectFromContractRemoteArgument(RemoteArgument remoteArg, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.TypeServices.ObjectFromRemoteArgument(RemoteArgument remoteArg, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.Internal.ProxyHelpers.PostProcessArguments(Object[] originalArguments, IRemoteArgumentArrayContract remoteArguments, ParameterInfo[] remoteArgumentInfo, RemoteArgument remoteRetval, Type remoteRetvalInfo, TypeInfrastructureManager typeInfrastructureManager)
           bei Microsoft.VisualStudio.Tools.Applications.RemoteMethodInfo.Invoke(Object target, BindingFlags invokeAttr, Binder binder, Object[] arguments, CultureInfo culture)
           bei System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

    The interesting fact ist, that the returning of an object array is working perfectly. I tried this with the addin code
    Public Function OnTest() As Object()
      Return New Object() {"ABC", "DEF", 3}
    End Function

    This code works perfectly, I get the array with the three values in the host context.

    When I try to do the following:

    Return New Object() { New Object() {"ABC", "DEF", 3}, New Object() {"GHI", "KLM", 4} }

    I get the exception mentioned above.

    Is ist in general possible to return an object array with more than one dimension? There seems to be some standard array serializer/deserializer, what is it capable of?
View as RSS news feed in XML