Community
Showing results for 
Search instead for 
Do you mean 
Reply

Error when calling GetFieldDescriptors

Accepted Solution Solved
Copper Contributor
Posts: 31
Country: United Kingdom
Accepted Solution

Error when calling GetFieldDescriptors

[ Edited ]

I have a list of custom entities related to a Company record. The problem occurs sometimes, but not always, when I try to get a list of field descriptors. The Manager appears to be created sucessfully but the call to GetFieldDescriptors produces "Object reference not set to an instance of an object". Code as below.

 

Dim CustomManager As CustomSubEntityManager(Of MyEntity)
Dim FieldList() As DBFieldDescriptor

 

CustomManager = Instance.CustomEntities.GetSubEntityManager(Of MyEntity)(Instance.CustomEntities.GetCustomEntityDescriptor("MyEntity"))
FieldList = CustomManager.GetFieldDescriptors()

 

Could anybody help?

 

Luke

 


Accepted Solutions
Solution
Accepted by topic author lukedev
‎12-08-2020 09:50 AM
Copper Contributor
Posts: 31
Country: United Kingdom

Re: Error when calling GetFieldDescriptors

I've resolved this. In case anyone else comes across similar problems...

When I had finished with the CustomManager object I was disposing of it using CustomManager.Dispose. I considered that to be good practice. However, it appears that once it has been disposed of, any further instances that you then create will not work properly and will cause the same error.

So, in short, don’t use CustomManager.Dispose.

Luke 

 

View solution in original post


All Replies
Solution
Accepted by topic author lukedev
‎12-08-2020 09:50 AM
Copper Contributor
Posts: 31
Country: United Kingdom

Re: Error when calling GetFieldDescriptors

I've resolved this. In case anyone else comes across similar problems...

When I had finished with the CustomManager object I was disposing of it using CustomManager.Dispose. I considered that to be good practice. However, it appears that once it has been disposed of, any further instances that you then create will not work properly and will cause the same error.

So, in short, don’t use CustomManager.Dispose.

Luke