OS Loader Locks

T

Tiret Ohf D.

Hi everybody,

I am using Visio control in a C# application and I have found out, that
this code leads to the OS Loader Exception during closing the
application (code executed in a form, then the form was closed, and
finally I close the application, containing the form)
-----------
public string OpenStencil(string FullPath)
{
try
{
m_Documents.OpenEx(FullPath, (short)VisOpenSaveArgs.visOpenRO);

return Ok;
}
catch (Exception ex)
{
return ex.Message;
}
}
-----------
If I'll comment the call and not unsubscribe from Visio events (like
MarkerEvent) the exception will show its ugly face again in the same
circumstances.

I think that the problem lies in a reference to the document that is
not releasing when I attempt to replace it with OpenEx. The OpenEx is
used to load a stencil into control.

Genossen, what am I doing wrong?
 
M

Michel LAPLANE

I think the problem is not in opening stencil but in the management of the
event.
If you have used addvise strategy, be sure to delete the event in the
destructor of the form containing the VDC.Because some event could be fired
again when your application is closing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top