.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error reading Dictionary "Object reference not set to an instance of an object"

5 REPLIES 5
Reply
Message 1 of 6
SRSDS
530 Views, 5 Replies

Error reading Dictionary "Object reference not set to an instance of an object"

Can anyone please explain what is going wrong here.

I'm getting a "NullReferenceException. Object reference not set to an instance of an object" using:

 

    For Each SetEntry As DBDictionaryEntry In SetRootDict
        Dim SetEntryDict As DBDictionary = CType(SetEntry.Value.GetObject(OpenMode.ForRead), DBDictionary)
    Next

I have the same lines letter for letter in a different procedure and referring the same unchanged root dictionary where it works fine.  

 

 

 

 

5 REPLIES 5
Message 2 of 6
SRSDS
in reply to: SRSDS

I replaced it with an alternative that works.

Dim SetEntryDict As DBDictionary = trans.GetObject(SetRootDict.GetAt(SetEntry.Key), OpenMode.ForRead)

A bit confused why the previous line would work in one location and not another.

Message 3 of 6
jeff
in reply to: SRSDS

Was one inside a transaction and the other not?

 

If not When TopTransaction is called it might cause that.

 

 

You can also find your answers @ TheSwamp
Message 4 of 6
SRSDS
in reply to: jeff

Hi Jeff,

 

Both are located inside the top transaction. I think this is relevant but the only difference I see is that the one that didn't work  was being called from an override. Probably not it though, just taking a wild stab.

 

 

 

Message 5 of 6
jeff
in reply to: SRSDS

Override in a overrule?

 

If in a overrule's check out Stephen Preston's classes on it and if I remember correctly he suggests using OpenCloseTransactions

You can also find your answers @ TheSwamp
Message 6 of 6
SRSDS
in reply to: jeff

Sorry.. during an overrule. not an override

Yea I've read the classes and watched the videos.

I forgot about the OpenCloseTransactions thing. 

Everything seems to be stable at the moment but I should change that.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost