.NET

.NET

Reply
Mentor
SRSDS
Posts: 255
Registered: ‎04-15-2011
Message 1 of 8 (489 Views)

FatalExecutionEngineError was detected

489 Views, 7 Replies
04-16-2012 01:03 PM

Hi all,

I have almost finished an application which has been working fine on small drawing files.

I don't know that it's the big drawing that is the problem but I've just tried to open a larger 7Mb file and am getting a FatalExecutionEngineError.

 

The error stems from a reactor that reviews the drawing on open (DocumentBecameCurrent). More specifically it is trying to open the NOD. 

 

Attached are screenshots of the reactor and the error. Can someone suggest what might be upsetting it.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,581
Registered: ‎06-29-2007
Message 2 of 8 (485 Views)

Re: FatalExecutionEngineError was detected

04-16-2012 01:16 PM in reply to: SRSDS

Hi,

 

what I see, just a short look to the screenshots: you do a transaction.Commit, but you don't do a transaction.Dispose ... and not disposing a transaction is imho one of the things you should really avoid.

 

HTH, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Mentor
SRSDS
Posts: 255
Registered: ‎04-15-2011
Message 3 of 8 (484 Views)

Re: FatalExecutionEngineError was detected

04-16-2012 01:30 PM in reply to: Alfred.NESWADBA

Hi Alfred,

I've just done a find and replace to include a trans.dispose after all the trans.commit s.

I'm still left with the same error.

 

Another application appears to have used the NOD on this drawing. Could it be that it has left a broken trail somewhere?

*Expert Elite*
Alfred.NESWADBA
Posts: 9,581
Registered: ‎06-29-2007
Message 4 of 8 (476 Views)

Re: FatalExecutionEngineError was detected

04-16-2012 01:38 PM in reply to: SRSDS

Hi,

 

>> Another application appears to have used the NOD on this drawing.

>> Could it be that it has left a broken trail somewhere?

What I'm thinking about is that if you do some modifications in the drawing without starting a command (like you do it during the event-handler) you normally have to lock the document.

 

I don't see you lock it. But then you would get another error message, so I didn't mention this in my first thread ..... BUT NOW, as you wrote that you are running multiple applications parallel, both accessing the same objects, it would be time to check that. Try either to write a log-file so you can see what applications have what objects opened/modified/closed at the moment the debugger stops because of this exception.

 

Good luck, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Mentor
SRSDS
Posts: 255
Registered: ‎04-15-2011
Message 5 of 8 (450 Views)

Re: FatalExecutionEngineError was detected

04-17-2012 05:53 PM in reply to: Alfred.NESWADBA

Hi again,

 

Not sure how to create a log file but there's only my application running at the moment. The other NOD entries must have been created on another computer at another time. 


I'm not sure how to create a log file..however...I think I've found the source of the problem.

 

Something is wrong with the 

Dim psr As PromptSelectionResult = ed.SelectAll(filter)

line in the following procedure. Trying to step past it causes the computer to think for a while before failing. It is a big file and maybe this is the problem?

 

 

    Public Sub GetTitleBlocks(ByVal trans As Transaction, ByVal db As Database, ByVal ed As Editor)
        Dim values As TypedValue() = New TypedValue() {New TypedValue(CType(DxfCode.ExtendedDataRegAppName, Short), "TitleBlock")}
        Dim filter As SelectionFilter = New SelectionFilter(values)
        Try
            Dim psr As PromptSelectionResult = ed.SelectAll(filter)
            If psr.Status = PromptStatus.OK Then
                Dim idarray As ObjectId() = psr.Value.GetObjectIds()
                TitleBlockDict.Clear()
                TitleBlockDict.Add("", "Unassigned")
                For Each ObjID In idarray
                    Dim Ent As Entity = trans.GetObject(ObjID, OpenMode.ForRead)
                    Dim myXdata As Array = Ent.XData.AsArray
                    TitleBlockDict.Add(myXdata.GetValue(1).value, GetAttributeValue(ObjID, "DRAWING_NO", trans))
                Next
            End If
        Catch ex As Autodesk.AutoCAD.Runtime.Exception
            MsgBox("Exception:" + ex.Message)
        End Try
    End Sub
Distinguished Mentor
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 6 of 8 (447 Views)

Re: FatalExecutionEngineError was detected

04-17-2012 06:49 PM in reply to: SRSDS

Hi:

 

Not sure (did not test your code) but, I think it's better tofilter for xdata regap this way:

 

Dim value(0) as TypedValue

 

value.SetValue(New TypedValue(DxfCode.ExtendedDataRegAppName,"RegapName"),0)

 

Gaston Nunez

Mentor
SRSDS
Posts: 255
Registered: ‎04-15-2011
Message 7 of 8 (425 Views)

Re: FatalExecutionEngineError was detected

04-22-2012 05:03 PM in reply to: gasty1001

Hi again,

 

It took a long while but I've figured out that the error occurs when the selection (Dim psr As PromptSelectionResult = ed.SelectAll(filter)) is being attempted while in paperspace and not model space.

 

Would I need to use code to switch to modelspace first or is there coding I can use to make the filtered selection from modelspace directly?

 

 

Mentor
SRSDS
Posts: 255
Registered: ‎04-15-2011
Message 8 of 8 (404 Views)

Re: FatalExecutionEngineError was detected

04-24-2012 11:59 AM in reply to: SRSDS

I worked out that

 

I was not thorougly enough passing the e.Document.Editor, e.Document.Database & e.Document.TransactionManager.StartTransaction through to all the procedures in the event handlers.

 

This is strange to me but..

I was also adding handlers to the opened document before conducting some routines on the drawing.

Adding the handlers after the routines seemed to help.

 

Took a lot of trial and error to work out the order of routines and event handlers to get it error free.

DocumentActivationChanged is one event I couldn't figure out.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.