Object Reference Not Set to Instance of an Object


#1

So I have been referencing a dictionary for some time now and all of the sudden it is telling me that “object reference is not set to an instance of an object” when I try to do a write line. It was working fine yesterday and now no longer is. I am positive that the dictionary contains a key for which I am trying to reference so I am very confused.

Please help. Thanks


#2

Hi.

That error tells me that your dictionary contains nothing.
You can check this with (variable is Nothing)

If that is true, then you’ll need to identify why it’s not being initialized. Sometimes if you have it surrounded by a Try/Catch and an error is thrown, it skips initialization, so in that case you could place a Rethrow in the Catch and find out what the error is or also output exception.Source+" - "+exception.Message

So, you’ll need to find out where and why your dictionary is failing to initialize to something.

Regards.


#3

Thank you very much