Object Reference not set to instance of an object

Object Reference not set to instance of an object

Moshe-A
Mentor Mentor
2,155 Views
4 Replies
Message 1 of 5

Object Reference not set to instance of an object

Moshe-A
Mentor
Mentor

Hey Guys

 

In my current application i populate 2 detail items + a spot coordinate on some views (selected from a form)

while testing the app some times i'm getting the exception in the title but some times not and today i decided to explore it and came to this conclution:

the exception is thrown by Revit API

 

case 1:

starts Revit, open an existing model, invoke my app command, select a view (or some view for populate) and the 2 detail items family are already loaded in the model, the app works fine.

 

case 2:

start Revit, open an existing model, delete any existing instances of my detail items, purge the detail items from the database and then invoke my app command, select a view Bom i'm getting the exception. to recover from this i just draw some thing a wall or even a line and the app works.

 

i enter deep in the code to find from where the exception is coming and it's the view collector.

it seems that after purging the detail items the new created view collector has garbage

 

does any one here familer with this and has a workaround?

(i am working with R2015 and still do not know what going up)

 

 

thanks in advance

Moshe

 

 

 

0 Likes
2,156 Views
4 Replies
Replies (4)
Message 2 of 5

Mustafa.Salaheldin
Collaborator
Collaborator

Can you provide a sample code?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 3 of 5

MarryTookMyCoffe
Collaborator
Collaborator

i know that rooms stays in memory, that for sure, maby something else too, try check if something isValidObject before you use it.

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 4 of 5

Revitalizer
Advisor
Advisor

Hi,

 

may it be that the FamilySymbol you use for placing detail items is not active yet?

In this case it would need to be activated before placing instances.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 5 of 5

shailkolhe.55
Community Visitor
Community Visitor

Error initialising document revised 30jan 20

description object reference not set an instance of an object

when I live since to lumion

0 Likes