Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: NullReferenceException
PostPosted: Sat Jun 22, 2019 12:10 pm 

Joined: Tue Jun 11, 2019 6:06 pm
Posts: 9

Offline
I have two instances where if I try to run the program on specific Screens the program throws a NullReferenceException on an Object - yet if I change to a different screen in IX Developer and run the code it works just fine.

The weird one is I am not sure why it is throwing this exception. In the first case it is a ScriptModule where I have created a Dictionary. In one of the functions I am trying to get the size of the Dictionary using Dictionary.Count. I assumed that this was due to a newly defined Dictionary with no entries causing this problem when the Count is called. The issue is from everything I read a newly defined Dictionary will give a count of 0 from the start.

The second is on another screen where I am checking to see if the user has entered some information on click of a button. The tag attached to the input field is a string and on button push I am checking if the string is Null or empty. Apparently checking to see if a tag is Null or empty seems to throw this exception.


 Profile  
 
 Post subject: Re: NullReferenceException
PostPosted: Tue Jul 02, 2019 12:37 am 

Joined: Tue Jun 11, 2019 6:06 pm
Posts: 9

Offline
I will leave this one alone for now. Is weird because it is throwing a NullException whe i am testing for Null so not sure why that is.

If I go to the tags tab I cab build and run and program works fine - so at this point assuming this is a weird glitch in the system. Then again now I am having a problem with the IEmailSenderService so maybe the glitch is a bit more than a glitch - will send another message for this one.


 Profile  
 
 Post subject: Re: NullReferenceException
PostPosted: Tue Jul 02, 2019 7:07 am 

Joined: Mon Jun 11, 2012 2:10 pm
Posts: 129

Offline
If I had to guess, you have something in your code like

if ( a.b.c == null ) ...

and the NullReferenceException is being thrown due to a.b being null.

_________________
Adam M.
Controls Engineer
FlexEnergy


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: