COMException when Initializing AxDrawingControl (E_FAIL)

V

Veronika Zenz

Hello,

We are developing a c#.net application that integrates the visio
drawing control into a mdi-interface.
Since we have migrated from Visio2003 to 2007 and .NET 2.0 we
occasionally get the following ComException in the InitializeComponent
Function:


System.Runtime.InteropServices.COMException (0x80004005): Beim Aufruf
einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben.
bei System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid&
clsid, Object punkOuter, Int32 context, Guid& iid)
bei System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
bei System.Windows.Forms.AxHost.CreateWithLicense(String license,
Guid clsid)
bei System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
bei System.Windows.Forms.AxHost.CreateInstance()
bei System.Windows.Forms.AxHost.GetOcxCreate()
bei System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
bei System.Windows.Forms.AxHost.CreateHandle()
bei System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
bei System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
bei System.Windows.Forms.AxHost.EndInit()
bei NEONdraw.Drawing.InitializeComponent()
bei NEONdraw.Drawing..ctor()
bei NEONdraw.Drawing..ctor(String filename)
(the text in german means something like "a call to a COM-Component
returned Error HRESULT E_FAIL")


In development mode it is very hard to reproduce, but at the release
PC this error occurs regularly.
Usually the error happens when the user closes all open drawings and
then opens a new drawing. Once this error has occured all later
attempts to open a drawing fail with the same error message.



We've been trying to fix or at least understand this error for days
now, but without any success.

Thanks a lot for any hints & best regards,
Veronika





some additional code that might contain a hint to the reason of the
error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


class Drawing : System.Windows.Forms.Form
public Drawing(FileInfo)
{
InitializeComponent();

this.MdiParent = App.MainForm;
this.IsMdiContainer = false;

this.DC.Src = file.FullName;

// register Events
// must be AFTER dc.src = xxx, otherwise AccessViolations
occur (??)
EventSink eventSink = new EventSink();
eventSink.AddAdvise(DC.Document.Application,
this.DC.Document);
}

private void InitializeComponent()
{

System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(Drawing));

this.DC = new
AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl();
((System.ComponentModel.ISupportInitialize)
(this.DC)).BeginInit();
this.SuspendLayout();

[...]

((System.ComponentModel.ISupportInitialize)
(this.DC)).EndInit(); // <- Error occurs here
this.ResumeLayout(false);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
 

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