New Posts New Posts RSS Feed: Null Exception when creating an entity
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Null Exception when creating an entity

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

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: Null Exception when creating an entity
    Posted: 29-Sep-2011 at 8:35am
Hi Sam and mseeli,

Please upload a sample solution reproducing the issue. (against NorthwindIB please)

Thanks,
   Silvio.
Back to Top
mseeli View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Sep-2010
Location: Switzerland
Posts: 31
Post Options Post Options   Quote mseeli Quote  Post ReplyReply Direct Link To This Post Posted: 29-Sep-2011 at 7:07am
I am struggling with a similar problem:
CodeEntity is a DevForce Entity

CodeEntity ce = new CodeEntity();

causes a null reference exception.
All I want to do is to create a new empty CodeEntity.
Without attaching it do a manager or accessing a database

Could it have something to do that I try to do that in a console application 
and I only have DevForce for Silverlight?

The same code works fine in Silverlight.




Back to Top
Sam View Drop Down
Newbie
Newbie


Joined: 27-Sep-2011
Location: Australia
Posts: 2
Post Options Post Options   Quote Sam Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2011 at 7:04pm
It's when I split the Silverlight side out, so that the Model (shared code) is in a separate SL project to the SL app.

Nothing in DebugLog other than saying it's listening.
It will connect to the server and give a IsConnected=true.

If I put the shared code in the SL app and not the SL project file, then it works fine.

Regards,
Sam.


Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2011 at 2:21pm
I've had this problem before. I can't quite remember what the issue was though, I think it was in a unit test project.

Is anything showing up in the debuglog?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2011 at 11:45am
Hi Sam,

If I understand correctly you are trying to have your model in a project separated from the Web project. 

If that's the case, have you taken a look at the steps provided in the DevForce Resource Center?

If not, could you upload a simple solution reproducing the issue?

Thanks.
   Silvio.
Back to Top
Sam View Drop Down
Newbie
Newbie


Joined: 27-Sep-2011
Location: Australia
Posts: 2
Post Options Post Options   Quote Sam Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2011 at 5:30am
Hello,
Can someone help me?

I have a very simple model/web to Silverlight App that is functioning fine.

However; if I move the DomainModel generated code to it's own Silverlight Library project, add all the same references that are in the Silverlight Application, reference the SL library and run the same thing... When I try to create an entity (any entity), I'm getting a null exception.

e.g. 
var myHero = new Hero();
Object reference not set to an instance of an object.
 at IdeaBlade.EntityModel.Entity..ctor()

Any suggestions on what the issue is or where I can start looking?
Regards,
Sam.



Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down