Casting SimpleRecord setting all values to null

Showing 1-10 of 10 messages
Casting SimpleRecord setting all values to null Scott Chappel 8/28/12 3:10 PM
I seem to be having an issue that I just cant track down.  When I am using db.table.All().ToList<T>() all the POCOs in the list have their values set to null.  I have tried enumerating the db.table.All() and casting the SimpleRecord to the correct POCO, but it is still having its values set to null.  I have had a look at the dictionary of values in the SimpleRecord and they match to the POCO.

Any thoughts?
Re: Casting SimpleRecord setting all values to null Mark Rendle 8/28/12 4:07 PM
Is this just happening in your medium-trust production env, or in dev too?
Re: Casting SimpleRecord setting all values to null Scott Chappel 8/28/12 10:35 PM
I have updated my local dev back to full trust and the problem is still occurring.  There are no exceptions being generated/logged either.
Re: Casting SimpleRecord setting all values to null Scott Chappel 8/28/12 10:42 PM
Actually...Let me correct that (I had set the wrong level of trust in the config file).  On my local dev box with the trust level = Full, everything works as expected.  On trust level = Medium the SimpleRecord will not convert to the correct type (all properties a null).
Re: Casting SimpleRecord setting all values to null Scott Chappel 8/29/12 2:53 AM
I have stripped out some of the exception handling in the dynamic methods (CreateTrySimpleAssign) and I am getting the following exception:
Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Collections.Generic.IDictionary`2<System.String,System.Object>)' to access type 'System.RuntimeType' failed

at lambda_method(Closure , IDictionary`2 )
at Simple.Data.ConcreteTypeCreator.Create(IDictionary`2 source) in D:\\Projects\\3rd Party\\Simple.Data\\Simple.Data\\ConcreteTypeCreator.cs:line 35
at Simple.Data.ConcreteTypeCreator.TryCreate(IDictionary`2 source, Object& result) in D:\\Projects\\3rd Party\\Simple.Data\\Simple.Data\\ConcreteTypeCreator.cs:line 42

I assume that this is a security related exception, but I am not sure.

Re: Casting SimpleRecord setting all values to null Mark Rendle 8/29/12 2:55 AM
Good detective work, thank you. I'm just getting something running in MT to do some testing, will get this resolved ASAP.

Mark
Re: Casting SimpleRecord setting all values to null Mark Rendle 8/29/12 3:35 AM
Right, with a bit of legwork and the help of an excellent Stack Overflow answer (http://stackoverflow.com/questions/3194678/expressiontdelegate-compile-in-medium-trust-environment) I believe I have killed the bug.

I've pushed the fixed code to GitHub, would you be able to build from that and test with your project? I'd really appreciate it. Unlimited free licenses and everything ;)

Cheers,
Mark
RE: Casting SimpleRecord setting all values to null Scott Chappel 8/29/12 4:20 AM
lol :)...I will let you know.


Date: Wed, 29 Aug 2012 11:35:32 +0100
Subject: Re: Casting SimpleRecord setting all values to null
From: ma...@markrendle.net
To: simpl...@googlegroups.com
RE: Casting SimpleRecord setting all values to null Scott Chappel 8/29/12 4:33 AM
And the winner is :)

Thanks Mark, greatly appreciated.


From: scha...@hotmail.com
To: simpl...@googlegroups.com
Subject: RE: Casting SimpleRecord setting all values to null
Date: Wed, 29 Aug 2012 21:20:50 +1000
Re: Casting SimpleRecord setting all values to null Mark Rendle 8/29/12 5:27 AM
No problem, thanks for your help.

M