Problem in InvisibleAppClass of MS Visio
Hello,
I am facing problem in trying to create an instance of Visio Application class (InvisibleAppClass) in my ASP.Net class constructor. I am trying to integrate MS Visio with ASP.Net. Whenever I make a call to my class constructor from a test web page, it actually creates 2 instances of Visio in memory.
To help you understand better, I have included the code below :
Web form code :
private void Page_Load(....)
{
int i = 9; // some code I wrote to check the flow of logic - Line 1
VisioAdapter objVisio = new VisioAdapter(); // Code to call Class constructor - Line 2
int i = 10; // some code I added to check the flow of logic. - Line 3
Rest of code
.....
.....
}
Class code
public class VisioAdapter()
{
InvisibleAppClass visioApp; // Visio Application class
public VisioAdapter() // class constructor
{
visioApp = new InvisibleAppClass();
}
}
On running the code (in debug mode), I found that after the class constructor code executes, the control returns to line 1 (in web form) instead of line 3. As a result line 2 code (code to call class constructor) gets invoked again. This results in 2 copies of Visio getting created in memory. In short, after the call to create an object of InvisibleAppClass gets over, the Page Load of web form is happening.
I am unable to understand the reason why this is taking place. If I run the same code in windows application, it works fine (ie only 1 instance of visio gets created).
Can you pl help me in cracking this problem (or if there might be a better way to do this).
Thanks
Gaurav