executionengineexception in forms.dll

  • Thread starter Thread starter MD
  • Start date Start date
M

MD

I have been converting a program from VB6 to VB.Net and enhancing it as
well. All has been progressing OK although its been hard work. Now, all of
a sudden, when I try to execute a ShowDialog() on one of my forms I get "An
unhandled exception of type 'System.ExecutionEngineException' occurred in
system.windows.forms.dll".

I can't work out what has caused this, and can't find any help on the
Microsoft site or anywhere else on the web. Can anyone help?

Thanks,
Mike
 
Hi MD,

|| Can anyone help?

Maybe, he says tentatively. ;-)

You'll need to show us the code - where it's called and the New and Load
of the dialogue..

Regards,
Fergus
 
MD said:
I have been converting a program from VB6 to VB.Net and enhancing it
as well. All has been progressing OK although its been hard work.
Now, all of a sudden, when I try to execute a ShowDialog() on one of
my forms I get "An unhandled exception of type
'System.ExecutionEngineException' occurred in
system.windows.forms.dll".

I can't work out what has caused this, and can't find any help on
the Microsoft site or anywhere else on the web. Can anyone help?

Please post the callstack when the execption occurs.
 
MD said:
I have been converting a program from VB6 to VB.Net and enhancing it as
well. All has been progressing OK although its been hard work. Now, all of
a sudden, when I try to execute a ShowDialog() on one of my forms I get "An
unhandled exception of type 'System.ExecutionEngineException' occurred in
system.windows.forms.dll".

I can't work out what has caused this, and can't find any help on the
Microsoft site or anywhere else on the web. Can anyone help?

That's a really bad exception. Do you use any ActiveX controls or the
controls from the Visual Basic Compatibility Library on the
form?
 
Thanks for your responses. First of all, an apology. The line it crashes
on is not the ShowDialog() but the statement
CType(Me.CommonDialog1,
System.ComponentModel.ISupportInitialize).BeginInit()
which is issued during the processing of ShowDialog(). I thought it was the
ShowDialog() but that was when it occurred if I commented out the real
culprit. Here's some more info you requested:

Armin: the stack contains this:
[ said:
SCS.exe!scs.fmEdit.InitializeComponent() Line 2748 + 0x24 bytes Basic
SCS.exe!scs.fmEdit.New() Line 23 + 0xb bytes Basic
SCS.exe!scs.fmEdit.get_DefInstance() Line 2763 + 0x14 bytes Basic
SCS.exe!scs.CueEditor.displayEdit(Integer pCuePtr = 1) Line 124 + 0x6
bytes Basic
SCS.exe!scs.fmMain.btnEdit_Click(Object eventSender =
{System.Windows.Forms.Button}, System.EventArgs eventArgs =
{System.EventArgs}) Line 2225 + 0x9 bytes Basic
[<Non-user Code>]
SCS.exe!scs.frmSplash.Main() Line 5 + 0x1d bytes Basic

Herfried: I'm not sure how to identify an ActiveX control, but there are
some VB6 controls that I do still use. In the references section I have
some Ax... references, so I guess these are the ActiveX controls. The Ax...
references shown are AxMSComCtl2, AxMSComctlLib, AxMSComDlg,
AxMSFlexGridLib, AxRichTextLib. There are also references to these same
names without the Ax, eg MSComCtl2, etc. Does this mean I still have a lot
of VB6 baggage hanging around? I'd like to keep the FlexGrid as it seems to
me to be a major job to convert this to a DataGrid, but if I should be
converting any of the other controls to VB.Net equivalents then I will.

Fergus: The ShowDialog() is called by clicking a button from my main form,
which executes this:

Private Sub btnEdit_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles btnEdit.Click
Dim nCurrentCue As Integer
nCurrentCue = grdCues.Row ' grdCues is MSFlexGrid
displayEdit(nCurrentCue)
fmEdit.DefInstance.ShowDialog()
End Sub

The fmEdit New sub is as follows:
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'For the start-up form, the first instance created is the default
instance.
If
System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is
Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub

The InitializeComponent is 2560 lines long, starting with:
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(fmEdit))

and the line it actually crashes on is:
CType(Me.CommonDialog1,
System.ComponentModel.ISupportInitialize).BeginInit()
which is about 150 lines into InitializeComponent.

Earlier in the code (earlier than the start of InitializeComponent) is:
Me.CommonDialog1 = New AxMSComDlg.AxCommonDialog

I appreciate your help, everyone.

Regards,
Mike
 
MD said:
Thanks for your responses. First of all, an apology. The line it
crashes on is not the ShowDialog() but the statement
CType(Me.CommonDialog1,
System.ComponentModel.ISupportInitialize).BeginInit()
which is issued during the processing of ShowDialog(). I thought it
was the ShowDialog() but that was when it occurred if I commented out
the real culprit. Here's some more info you requested:

Armin: the stack contains this:
[ said:
SCS.exe!scs.fmEdit.InitializeComponent() Line 2748 + 0x24 bytes
Basic SCS.exe!scs.fmEdit.New() Line 23 + 0xb bytes Basic
SCS.exe!scs.fmEdit.get_DefInstance() Line 2763 + 0x14 bytes
Basic SCS.exe!scs.CueEditor.displayEdit(Integer pCuePtr = 1) Line 124
+ 0x6 bytes Basic
SCS.exe!scs.fmMain.btnEdit_Click(Object eventSender =
{System.Windows.Forms.Button}, System.EventArgs eventArgs =
{System.EventArgs}) Line 2225 + 0x9 bytes Basic
[<Non-user Code>]
SCS.exe!scs.frmSplash.Main() Line 5 + 0x1d bytes Basic


Could you please expand the "non-user code" (by right-clicking in the
callstack window and select "expand non-user code" (or similar)) when the
exception occurs and post it again? As you wrote below, it must be somewhere
in ISupportInitialize.BeginInit, so the error might be hard to find.

The InitializeComponent is 2560 lines long, starting with:
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(fmEdit))

and the line it actually crashes on is:
CType(Me.CommonDialog1,
System.ComponentModel.ISupportInitialize).BeginInit()
which is about 150 lines into InitializeComponent.
Earlier in the code (earlier than the start of InitializeComponent)
is:
Me.CommonDialog1 = New AxMSComDlg.AxCommonDialog

Earlier? Before Sub InitializeComponent is called? Hard to imagine because
there should only be the "If m_vb6FormDefInstance Is Nothing..." stuff. The
assignment "Me.CommonDialog1 = ..." should be _within_ Initializecomponent.
 
Hi Mike,

At this stage it's of no use to you other than interest, but there's
another on-going query regarding a program that crashes at the EndInit() of
ISupportInitialize. This time it's in association with an AxBrowser control.

Regards,
Fergus
 
Good morning Cor,

I usually give the topic but I left it out this time because it's very
long (30 messages) and the bulk of it is on a different issue. The "BANG!,
zip, pop and whirr" problem only arises in the last few messages when the
first issue had been thoroughly [but :-(( unsuccesfully] explored.

The topic is: Strange? DesignMode Behaviour, dated 19th Sep, 11:00am

Regards,
Fergus
 
Good morning Fergus,

I got the idea already that it had to do with Charles
I did give a small answer to Charles in the other thread.
It is something I always have to think on when I have those problems with
the webbrowser but never did investigation in.

Cor
 
Armin: the stack contains this:
[ said:
SCS.exe!scs.fmEdit.InitializeComponent() Line 2748 + 0x24 bytes
Basic SCS.exe!scs.fmEdit.New() Line 23 + 0xb bytes Basic
SCS.exe!scs.fmEdit.get_DefInstance() Line 2763 + 0x14 bytes
Basic SCS.exe!scs.CueEditor.displayEdit(Integer pCuePtr = 1) Line 124
+ 0x6 bytes Basic
SCS.exe!scs.fmMain.btnEdit_Click(Object eventSender =
{System.Windows.Forms.Button}, System.EventArgs eventArgs =
{System.EventArgs}) Line 2225 + 0x9 bytes Basic
[<Non-user Code>]
SCS.exe!scs.frmSplash.Main() Line 5 + 0x1d bytes Basic


Could you please expand the "non-user code" (by right-clicking in the
callstack window and select "expand non-user code" (or similar)) when the
exception occurs and post it again? As you wrote below, it must be somewhere
in ISupportInitialize.BeginInit, so the error might be hard to find.

Here it is:


system.windows.forms.dll!System.Windows.Forms.AxHost.ConnectionPointCookie.C
onnectionPointCookie(System.Object source = {System.__ComObject},
System.Object sink = {AxMSComDlg.AxCommonDialogEventMulticaster},
System.Type eventInterface = {"MSComDlg.ICommonDialogEvents"}) + 0x1d4 bytes
axinterop.mscomdlg.dll!AxMSComDlg.AxCommonDialog.CreateSink() + 0x78 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.StartEvents() + 0x45
bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.TransitionUpTo(int
state = 2) + 0xf5 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.CreateHandle() + 0x24
bytes
system.windows.forms.dll!System.Windows.Forms.Control.CreateControl(bool
fIgnoreVisible = true) + 0xdd bytes
system.windows.forms.dll!System.Windows.Forms.Control.CreateControl(bool
fIgnoreVisible = true) + 0x1c2 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.EndInit() + 0x32
bytes
SCS.exe!scs.fmEdit.InitializeComponent() Line 2750 + 0x24 bytes Basic
SCS.exe!scs.fmEdit.New() Line 23 + 0xb bytes Basic
SCS.exe!scs.fmEdit.get_DefInstance() Line 2765 + 0x14 bytes Basic
SCS.exe!scs.CueEditor.displayEdit(Integer pCuePtr = 1) Line 124 + 0x6
bytes Basic
SCS.exe!scs.fmMain.btnEdit_Click(Object eventSender =
{System.Windows.Forms.Button}, System.EventArgs eventArgs =
{System.EventArgs}) Line 2225 + 0x9 bytes Basic

system.windows.forms.dll!System.Windows.Forms.Control.OnClick(System.EventAr
gs e = {System.EventArgs}) + 0x5e bytes

system.windows.forms.dll!System.Windows.Forms.Button.OnClick(System.EventArg
s e = {System.EventArgs}) + 0x33 bytes

system.windows.forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Window
s.Forms.MouseEventArgs mevent = {X=25 Y=13 Button=Left}) + 0x133 bytes

system.windows.forms.dll!System.Windows.Forms.Control.WmMouseUp(System.Windo
ws.Forms.Message m = {System.Windows.Forms.Message},
System.Windows.Forms.MouseButtons button = Left, int clicks = 1) + 0x261
bytes

system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows
..Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes

system.windows.forms.dll!System.Windows.Forms.ButtonBase.WndProc(System.Wind
ows.Forms.Message m = {System.Windows.Forms.Message}) + 0x121 bytes

system.windows.forms.dll!System.Windows.Forms.Button.WndProc(System.Windows.
Forms.Message m = {System.Windows.Forms.Message}) + 0x85 bytes

system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.
Message m = {System.Windows.Forms.Message}) + 0x13 bytes

system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Me
ssage m = {System.Windows.Forms.Message}) + 0xda bytes

system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallbac
k(int hWnd = 198514, int msg = 514, int wparam = 0, int lparam = 851993) +
0x3d bytes

system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.S
ystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason
= -1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x50 bytes

system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
..Forms.Form mainForm = {scs.frmSplash}) + 0x34 bytes
SCS.exe!scs.frmSplash.Main() Line 5 + 0x1d bytes Basic
Earlier? Before Sub InitializeComponent is called? Hard to imagine because
there should only be the "If m_vb6FormDefInstance Is Nothing..." stuff. The
assignment "Me.CommonDialog1 = ..." should be _within_ Initializecomponent.

Yes, you're right. I got confused with all the code that is present.
"Me.CommonDialog1 = New AxMSComDlg.AxCommonDialog" IS within
InitializeComponent. The reference to CommonDialog1 that was before the
start of InitializeComponent is:

Public WithEvents CommonDialog1 As AxMSComDlg.AxCommonDialog

Mike
 
Thanks for your help, everyone. I have fixed the problem by replacing the
CommonDialog with OpenFileDialog. It would have taken me ages to sort that
out without the suggestions and ideas put forward by you guys.

Regards,
Mike
 
I thought I've already given you an answer, but now I see I didn't send it.
"More" see below. Meanwhile you found an alternative, so simply ignore me.
;-)
system.windows.forms.dll!System.Windows.Forms.AxHost.ConnectionPointCookie.C
onnectionPointCookie(System.Object source = {System.__ComObject},
System.Object sink = {AxMSComDlg.AxCommonDialogEventMulticaster},
System.Type eventInterface = {"MSComDlg.ICommonDialogEvents"}) +
0x1d4 bytes
axinterop.mscomdlg.dll!AxMSComDlg.AxCommonDialog.CreateSink() +
0x78 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.StartEvents() +
0x45 bytes

system.windows.forms.dll!System.Windows.Forms.AxHost.TransitionUpTo(int
state = 2) + 0xf5 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.CreateHandle()
+ 0x24
bytes

system.windows.forms.dll!System.Windows.Forms.Control.CreateControl(bool
fIgnoreVisible = true) + 0xdd bytes

system.windows.forms.dll!System.Windows.Forms.Control.CreateControl(bool
fIgnoreVisible = true) + 0x1c2 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.EndInit() +
0x32
bytes


The line above says that the error occurs in "EndInit". In your previous
posting you wrote that the error occurs in BeginInit.


Anyway, unfortunately I can't figure out why it is like it is. :-(
 
Back
Top