New Posts New Posts RSS Feed: 'System.Reflection.RuntimeMethodInfo' cannot be serialized
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

'System.Reflection.RuntimeMethodInfo' cannot be serialized

 Post Reply Post Reply
Author
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Topic: 'System.Reflection.RuntimeMethodInfo' cannot be serialized
    Posted: 08-Dec-2009 at 11:28am
Sort of relieved ... but I've a gnawing fear that something lurks in the Silverlight Unit Test darkness. I'm sure you'll let us know if something comes up.
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 08-Dec-2009 at 6:47am
I reverted back to an older (working) version of my source code and then made the last two weeks changes all over again. (Groan) (I hope I caught them all.) So far so good. The app works and the unit tests are all passing. This problem has gone away. I do not think this had anything to do with your code because the Domain Model tests were working all along. Thanks.
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 04-Dec-2009 at 1:30pm
Interesting. I was hoping for something more obvious ... in your code.
 
If I understand correctly, you are unable to make ANY query work in this environment using the Silverlight Unit Test framework.
 
Is it true that these same queries work (a) when run as part of the silverlight application and (b) when run from a .NET client (e.g., a console application)? Please confirm these first.
 
The next step is to examine the server-side debug log. That is ALWAYS an important source of information for almost any problem related to a communication with the server. You may find more information about the exception there.
 
Feel free to send that debug.log, your web.config, and your Silverlight app.config to me at AskWard-at-ideablade-period-com (expressed this way to avoid spambots). Make sure you mask out any connection string info that we should not have!
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 03-Dec-2009 at 6:53pm
This Silverlight Unit Test is testing the entire stack from the silverlight client to the database and back. The test setup configures the environment. We were having some problems with this particular query so that is what is in the test right now. It turned out that DevArt had a bug in their new driver, which they have since fixed in their latest driver. But now I am getting this error in the Persistence layer somewhere. I switched the query to work with Contact instead of Deal:
var query = from item in em.Contacts select item;

Contact is a purely generated class with no supplemental code in a developer partial. And it fails too. I think the problem has to be somewhere in the persistence layer but debugging this is a nightmare because everything is async. Yeuch.   
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 03-Dec-2009 at 5:11pm
Can't tell what's up. Recommend that you pair back the query until you find what phrase is killing you. Start with a query about Deal and work out.
 
When you find it, look at what seems different about the object types involved. If you need us we'll need the stack trace and the model of the entities in question before we can think of next steps.
 
Make sense?
 
P.s.:  Last two includes can be combined because Deal.DealTrxes.DealTrxPricings gets every leg in the path (and thus DealTrxes).
 
P.p.s: Performance and payload size considerations should make you wary of lots of includes. If you were writing the SQL would you do a 5-way join for this query which has NO Where clause? You want to look at such things carefully and profile them in the context of your expected production conditions.
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 03-Dec-2009 at 1:20pm
I reverted to 5.2.3 and I still get this. Not sure what I've done so any clues would help. Thanks.
Back to Top
skingaby View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 23-Apr-2008
Location: United States
Posts: 146
Post Options Post Options   Quote skingaby Quote  Post ReplyReply Direct Link To This Post Posted: 03-Dec-2009 at 12:53pm
I am getting this error. (I am using 5.2.4 beta). Is this your error or mine? Thanks!

-          args.Error     {IdeaBlade.EntityModel.EntityServerException: Type 'System.Reflection.RuntimeMethodInfo' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required. ---> System.Runtime.Serialization.InvalidDataContractException: Type 'System.Reflection.RuntimeMethodInfo' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.
   at IdeaBlade.EntityModel.RemoteEntityServerProxy.CheckConnection(Exception pException)
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchWorker(AsyncEventArgs state)
   --- End of inner exception stack trace ---}     System.Exception {IdeaBlade.EntityModel.EntityServerException}

Error occurs after this line:
EntityManager.ExecuteQueryAsync(
                    query,
                    args => QueryCallback(args, callback),
                    null);

The query is as follows:
var query = from item in em.Deals select item;
            query = query.Include(Deal.EntityPropertyNames.DealPricings)
               .Include(Deal.EntityPropertyNames.DealCharges)
               .Include(Deal.EntityPropertyNames.DealCost)
               .Include(Deal.EntityPropertyNames.DealTrxes)
               .Include(Deal.EntityPropertyNames.DealTrxes + "." + DealTrx.EntityPropertyNames.DealTrxPricings)
               ;

Edited by skingaby - 03-Dec-2009 at 12:55pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down