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.
NullReferenceException
Re: NullReferenceException
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.
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.
-
- Posts: 137
- Joined: Mon Jun 11, 2012 2:10 pm
Re: NullReferenceException
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.
if ( a.b.c == null ) ...
and the NullReferenceException is being thrown due to a.b being null.
Adam M.
Controls Engineer
FlexEnergy
Controls Engineer
FlexEnergy