muck Posted September 3, 2014 Share Posted September 3, 2014 Using VS 2010 with AutoCAD 2013 or 2014. I am getting Fatal Execution Engine Error was detected. The runtime has encountered a fatal error. The address of the error was at 0xe79d9f1a, on thread 0x1080. 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. It is in the statement DocumentExtension.CloseAndSave(acDocMgr.MdiActiveDocument, strFileName) How do I begin to trouble shoot this? Thank you, Quote Link to comment Share on other sites More sharing options...
muck Posted September 3, 2014 Author Share Posted September 3, 2014 I am using the following code in a loop. Public Class MyCommands <CommandMethod("OSCLoop", CommandFlags.Session)> _ Public Sub OSCLoop() ' This method can have any name ' Put your command code here Dim y As Integer Dim lines() As String = IO.File.ReadAllLines("C:\VBdwgFilelist.txt") Dim strFileName As String Dim lineArray As New ArrayList() Dim acDocMgr As DocumentCollection = Application.DocumentManager Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim obj As Object = Application.GetSystemVariable("DWGTITLED") y = 0 For x As Integer = 0 To lines.GetUpperBound(0) 'If TextBox1.Text = String.Empty Then If lines(x) <> String.Empty Then lineArray.Add(lines(y)) y = y + 1 End If Next 'MsgBox("Show each line") For x = 0 To lineArray.Count - 1 'MsgBox(lineArray.Item(x)) 'Open the drawing strFileName = lineArray.Item(x) MsgBox(strFileName) If (File.Exists(strFileName)) Then DocumentCollectionExtension.Open(acDocMgr, strFileName, False) 'START SAVE & CLOSE 'DocumentExtension.CloseAndDiscard(acDocMgr.MdiActiveDocument) DocumentExtension.CloseAndSave(acDocMgr.MdiActiveDocument, strFileName) MsgBox("Drawing Saved") Else acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " & strFileName & " does not exist.") End If Next End Sub End Class Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.