Casting SimpleRecord setting all values to null

56 views
Skip to first unread message

Scott Chappel

unread,
Aug 28, 2012, 6:10:35 PM8/28/12
to simpl...@googlegroups.com
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?

Mark Rendle

unread,
Aug 28, 2012, 7:07:28 PM8/28/12
to simpl...@googlegroups.com
Is this just happening in your medium-trust production env, or in dev too?

Scott Chappel

unread,
Aug 29, 2012, 1:35:23 AM8/29/12
to simpl...@googlegroups.com
I have updated my local dev back to full trust and the problem is still occurring.  There are no exceptions being generated/logged either.

Scott Chappel

unread,
Aug 29, 2012, 1:42:14 AM8/29/12
to simpl...@googlegroups.com
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).

Scott Chappel

unread,
Aug 29, 2012, 5:53:38 AM8/29/12
to simpl...@googlegroups.com
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.

Mark Rendle

unread,
Aug 29, 2012, 5:55:46 AM8/29/12
to simpl...@googlegroups.com
Good detective work, thank you. I'm just getting something running in MT to do some testing, will get this resolved ASAP.

Mark

Mark Rendle

unread,
Aug 29, 2012, 6:35:32 AM8/29/12
to simpl...@googlegroups.com
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

Scott Chappel

unread,
Aug 29, 2012, 7:20:50 AM8/29/12
to simpl...@googlegroups.com
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

Scott Chappel

unread,
Aug 29, 2012, 7:33:48 AM8/29/12
to simpl...@googlegroups.com
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

Mark Rendle

unread,
Aug 29, 2012, 8:27:27 AM8/29/12
to simpl...@googlegroups.com
No problem, thanks for your help.

M
Reply all
Reply to author
Forward
0 new messages