We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Diagram Control errors with used with threads

Thread ID:

Created:

Updated:

Platform:

Replies:

59779 Apr 21,2007 09:38 AM Apr 23,2007 04:08 PM Windows Forms 1
loading
Tags: Diagram
Michael
Asked On April 21, 2007 09:38 AM

I am using the Windows Diagram control to generate image files from diagrams that are generated through code in batch. However, I have problems because it turns out that the application that initiates my program is using a multiple threading apartment model (MTA). When I create a STA thread, I can only generate one diagram. Subsequent attempts to create diagrams errors.

The application works great when attached to a form for testing or from a console using a single threaded apartment (STA). I do not have a diagram control on a form. I use a self-contained class that creates a diagram control, draws the diagram and then saves the image.

When the class is then accessed through an external assembly, which is a console command, errors start occurring. I cannot seem to work through these errors because they are too deep into "Syncfusion.Diagram.Base".

The errors all start with the threaded apartment state. If the console command has a state of STA, no issues occur. However, if the state is MTA the problems start. I cannot control the state and it will be set to MTA. Below is a description of what has taken place.

I simply do not know what to do next. Any advice on what to do next will be appricated. I attached a demostration of the issue with a readme file that contains the specific errors.

-----------------------------------------------

- ROUND ONE -
The first time my class was created by the console command. I received “DragDrop registration did not succeed" (ERROR 1 - in readme.txt. Research tells me the source of this error is related to Windows Forms when the thread apartment state is in MTA mode.


- ROUND TWO -
I then spun a new STA thread to create the image. This worked fine for the first pass. However, if more than one diagram is created an Object Not Set error occurs. In other words, if I attempt to create a second instance of the diagram control, then I get an "Object reference not set to an instance of an object." (ERROR 2 - in readme.txt) on the following line of code.

Dim diagram = New Syncfusion.Windows.Forms.Diagram.Controls.Diagram

This error occurs regardless of how I attempt to dispose or set the diagram object to nothing, so a brand new instance of the object can be created from scratch. I attempted to clear out the diagram object from memory and start a new thread. Still get the error.


- ROUND THREE -
I attempted to keep the diagram control object declared and reuse it on the second pass. On the first pass the process worked fine. However once again on the second pass it errors. However, now the error is in the symbol not the diagram control. There are various "Object reference not set to an instance of an object" errors (ERROR 3 - in readme.txt) when adding label or nodes to the symbol. I have gotten further because I have a diagram object to use, but I cannot work with the symbols.




DiagramTestLibrary.zip

J.Nagarajan [Syncfusion]
Replied On April 23, 2007 04:08 PM

Hi Michael,

I was able to reproduce this issue in v.4.4.0.51. We have internally fixed this issue . Please create a Direct-Trac incident (mention the forum link in the subject line) so that we can update with the download link of the private patch including this fix.

Please let me know if you have any questions.

Thanks for using Syncfusion product.

Regards,
Nagaraj

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;