Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Catch FatalExecutionEngineError - MSScriptControl

89 views
Skip to first unread message

Onno

unread,
Feb 10, 2009, 9:03:11 AM2/10/09
to
Hi, I have an VB.NET app that uses an MSScriptControl. The user of my
app can create a 'library' of VBScripts which are executed by the
script control. All is fine until recently one user created this
script:

Dim args() ' --> Should be args(0), but user made typo
'args(0) = "Hello world"
Call MyApp.SomeFunction("arg1", "arg2", (args))

This crashes my app with an FatalExecutionEngineError which I cannot
catch?

My App does something like:
Try
m_ScriptControl = New MSScriptControl.ScriptControl
m_ScriptControl.AddObject("MyApp", m_MyAppAccessObject, False)
m_ScriptControl.AddCode(theCode)
m_ScriptControl.Run("Main")
Catch ex As Exception
MessageBox(ex.Message)
End Try

The catch block is not entered, but the application terminates with
this message:
FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the
error was at 0x7a038feb, on thread 0x124c. The error code is
0xc0000005. This error may be a bug in the CLR or in the unsafe or non-
verifiable portions of user code. Common sources of this bug include
user marshaling errors for COM-interop or PInvoke, which may corrupt
the stack.

What goes? Is it not possible to catch these kind of exceptions?

TIA, Onno

Eusebiu

unread,
Feb 10, 2009, 12:08:03 PM2/10/09
to
Hello...
You can try this...(C# code):
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += delegate(object sender,
UnhandledExceptionEventArgs args)
{
Exception e = (Exception) args.ExceptionObject;
Console.WriteLine("MyHandler caught : " + e.Message);
};
...

Hope this helps...

Onno

unread,
Feb 11, 2009, 10:03:22 AM2/11/09
to
On 10 feb, 18:08, Eusebiu <Euse...@discussions.microsoft.com> wrote:
> Hello...
> You can try this...(C# code):
> AppDomain currentDomain = AppDomain.CurrentDomain;
>       currentDomain.UnhandledException += delegate(object sender,
> UnhandledExceptionEventArgs args)
> {
>       Exception e = (Exception) args.ExceptionObject;
>       Console.WriteLine("MyHandler caught : " + e.Message);};
>
> ...
>
> Hope this helps...

Not really, not it crashes with:
"System.ExecutionEngineException was unhandled
Message: An unhandled exception of type
'System.ExecutionEngineException' occurred in Unknown Module."

There must be a way to catch this?

0 new messages