This is a migrated thread and some comments may be shown as answers.

System.Reflection.TargetInvocationException in Disconnected API

4 Answers 157 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kyaw Zayar Han
Top achievements
Rank 1
Kyaw Zayar Han asked on 11 Sep 2009, 07:35 AM
Hi,

We are using Telerik OpenAccess disconnected API for our application, with WCF.  Even though it managed to retrieve objects from database at server site and client site received changeset exactly the same length from server site, we encountered the following error when we load changeset to objectcontainer. It doesn't happen on all module but we can't fix this on a module, no matter what. The object graph contains 3, 4 level of object composition. The only exception is if we don't have any data in database for child object. it works.

Could you please help us to define problem and get soluction?

 "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> 
  System.TypeLoadException: Type "ANameSpace.Atype' could not be found.
   at Telerik.OpenAccess.RT.TypeResolver.AssociateTypeName(String dotnetname, Boolean complain)
   at Telerik.OpenAccess.RT.TypeResolver.ResolveTypeName(String dotnetname, Boolean complain)
   at Telerik.OpenAccess.RT.DisconnectedStateManager..ctor(SerializationInfo info, StreamingContext context)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
   at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
   at System.Runtime.Serialization.ObjectManager.DoFixups()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
   at Telerik.OpenAccess.ObjectContainer.Unwrap(ChangeSet cs)
   at Telerik.OpenAccess.ObjectContainer.Apply(ChangeSet changes)

Regards,
Han

4 Answers, 1 is accepted

Sort by
0
Kyaw Zayar Han
Top achievements
Rank 1
answered on 11 Sep 2009, 07:51 AM
A Ha,

Let me answer my question myself. .NET Runtime didn't load the reference assembly, because we never use any type from target assembly directly. 

Cheers!
0
Jan Blessenohl
Telerik team
answered on 11 Sep 2009, 09:30 AM
Hello Kyaw Zayar Han,
Perfect analysation.

Can you just have an instance of one type that is defined in your persistent classes assembly in the assembly that calls container.Apply? That will solve the problem.

Greetings,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gopinath
Top achievements
Rank 1
answered on 19 Mar 2013, 04:54 PM
Hello Team,

in my scenario, I have a similar issue. The length of the data received from server is not same after applying the changeset into the container. I dont receive any error but simply one object is missing when i query the offline container.

But when I tried to create new container and apply the same changeset, the length seems to be correct,
I confirmed that the missing objects are really available in the database. Do you have any idea of this issue?

Thanks,
Gopi
0
Jan Blessenohl
Telerik team
answered on 20 Mar 2013, 09:36 AM
Hello,
Are you talking about the amount of objects in the object container? Usually you do a:

ObjectContainer.Extent<T>()

To get all objects of one kind.

Kind regards,
Jan Blessenohl
the Telerik team
Free Webinar: OpenAccess Integration in Sitefinity. SIGN UP NOW.
Tags
Databases and Data Types
Asked by
Kyaw Zayar Han
Top achievements
Rank 1
Answers by
Kyaw Zayar Han
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Gopinath
Top achievements
Rank 1
Share this question
or