Fatal Error AutoCAD 2016

Fatal Error AutoCAD 2016

Anonymous
Not applicable
932 Views
4 Replies
Message 1 of 5

Fatal Error AutoCAD 2016

Anonymous
Not applicable

 

Hi,

 

I am getting a fatal error in AutoCAD 2016 caused by UpdateFileProperties during an AddFileEvents.Post event.

 

here is the first error message:

 

vaulting error.JPG

 

Followed by:

Fatal error.JPG

 

The code runs flawlessly, and always completes successfully.

This is not an issue for inventor or office files and only seems to be an issue with AutoCAD files.

I have debugged the code, and its the "VaultExplorerUtil.UpdateFileProperties(indfile, propsDict)" that causes the issue, when this line is removed, the error does not occur.

 

I don't know if there is an issue with my code, or the AutoCAD add in.

 

My code is below:

 

Public Sub OnLoad() Implements IWebServiceExtension.OnLoad

            AddHandler DocumentService.AddFileEvents.Post, AddressOf AddCreatorAndDateOnAddFile


        End Sub

        Private Sub AddCreatorAndDateOnAddFile(ByVal sender As Object, ByVal e As AddFileCommandEventArgs)

            'establish a connection to vault with current users details
            Dim results As VDF.Vault.Results.LogInResult
            Dim OrgName As String = System.Environment.UserName
            If e.FileName.EndsWith(".dwf") Or e.FileName.EndsWith(".DWF") Then
                Return
            End If
                            results = VDF.Vault.Library.ConnectionManager.LogIn("xxxxxxxx", "xxxxxxxx", "", "", VDF.Vault.Currency.Connections.AuthenticationFlags.WindowsAuthentication, Nothing)

            If Not results.Success Then
                Return
            End If
            Dim m_conn As Connection = results.Connection

            'get file id
            Dim FileNme As String = Right(e.FileName, Len(e.FileName) - InStrRev(e.FileName, "\"))
            Dim IndFileId As Long
            Dim AllFilesInFolder As File() = m_conn.WebServiceManager.DocumentService.GetLatestFilesByFolderId(e.FolderId, True)
            For Each Sepfile As File In AllFilesInFolder
                If Sepfile.Name = FileNme Then
                    IndFileId = Sepfile.Id
                    Exit For
                End If
            Next Sepfile

            'Get orginator name
            OrgName = Right(OrgName, Len(OrgName) - InStrRev(OrgName, "\")) 'remove domain
            OrgName = Replace(OrgName, ".", " ") 'replace the period with a space
            OrgName = StrConv(OrgName, VbStrConv.Uppercase) 'convert to uppercase

            'Get orginal create date
            Dim OrgDateDte As Date = Now
            Dim OrgDate As String = OrgDateDte.ToShortDateString

            'change properties
            'create dictionary
            Dim myPropDefArray As PropDef() = m_conn.WebServiceManager.PropertyService.FindPropertyDefinitionsBySystemNames("FILE", New String() _
                {"5716a6eb-53c9-4fb3-b13d-205edfc714c4", "505a747a-d62a-4a8b-bff9-2e149daafce2"})
            Dim propsDict As Dictionary(Of PropDef, Object) = New Dictionary(Of PropDef, Object)
            Dim OrgNameObj As Object = OrgName
            Dim OrgDateObj As Object = OrgDate

            propsDict.Add(myPropDefArray(0), OrgNameObj)
            propsDict.Add(myPropDefArray(1), OrgDateObj)

            'Load ExplorerUtil
            Dim VaultExplorerUtil As IExplorerUtil = ExplorerLoader.LoadExplorerUtil(m_conn.Server, m_conn.Vault, m_conn.UserID, m_conn.Ticket)

            'change properties
            Dim indfile As File = m_conn.WebServiceManager.DocumentService.GetFileById(IndFileId)
            Processing = True
            VaultExplorerUtil.UpdateFileProperties(indfile, propsDict)
            Processing = False

            'Close ExplorerUtil
            VaultExplorerUtil = Nothing

            'loggout of the vault server
            VDF.Vault.Library.ConnectionManager.LogOut(m_conn)

        End Sub

 

 

0 Likes
933 Views
4 Replies
Replies (4)
Message 2 of 5

sajith_subramanian
Autodesk Support
Autodesk Support

Hi @Anonymous,

 

Could you try wrapping your method in a Try/Catch block and see if you can find any additional details about the exception.

 

Usually it is not recommended to modify mapped properties from an event handler.

 

 

Regards,

Sajith


Sajith Subramanian
Autodesk Developer Network
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks Sajith,

 

I did try this with no effect. It seems the code completes correctly, but causes AutoCAD to crash after completion.

 

I have read about modifying mapped properties, however the properties I am changing and mapped in a single direction with the Vault property as the master. The file will update when the properties are synchronised. Works fine for this application.

0 Likes
Message 4 of 5

sajith_subramanian
Autodesk Support
Autodesk Support

Hi @Anonymous,

 

Can you confirm that this issue you are facing is not machine specific. Do you have any other machines with similar setups on which you can try running your code?

 

 

Regards,

Sajith


Sajith Subramanian
Autodesk Developer Network
0 Likes
Message 5 of 5

Anonymous
Not applicable

Hi Sajith,

 

I can confirm this error was common across 8 machines, using the latest firmware, and after multiple clean reinstallations.

0 Likes