Question : Using Threads: I get "Access Violation - no RTTI data" error

Hi,

I am coding a Laserfiche application in VB.NET. I create a connection to the Laserfiche server in it's own thread. I also start a thread with some specific code. I can successfully run all of the code, modifying entries in the database, until I get to this line:

****
 SubFolder.Create(SubFolderArray(z).ToString, Parent, False)
****

At this point, I get the error: Access violation - no RTTI data

I have googled this and Laserfiche themselves have the following resolution:

Summary:
If your Toolkit program shares a connection object across processes, you may receive the following error message when the second process attempts to retrieve repository information:

Access violation - no RTTI data!

You can also receive this error if you are sharing a connection object across threads in a .NET program.

Resolution:
Different processes and threads require their own serialized connection. Clone a connection by retrieving the serialized connection information from the existing connection and then create a new connection object using the serialized connection information. Please see the following Visual Basic sample on cloning a connection.

Dim contransfer As New LFConnection
Dim SerializedCon = db.CurrentConnection.SerializedConnection
contransfer.CloneFromSerializedConnection(SerializedCon)
db = contransfer.Database


I am not the most knowledgeable VB.NET programmer, and I don't really understand what I am doing wrong here.

Can anyone assist me?
Thanks
Sheldon

Answer : Using Threads: I get "Access Violation - no RTTI data" error

I have resolved my problem.

Was running the serialized connection code in the wrong place. I was supposed to run it before using any of the objects that are being shared between the threads. In this case, I was using "db" before creating the new serialized connection.

Random Solutions  
 
programming4us programming4us