Message 1 of 5
Fatal Error AutoCAD 2016

Not applicable
12-06-2017
06:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am getting a fatal error in AutoCAD 2016 caused by UpdateFileProperties during an AddFileEvents.Post event.
here is the first error message:
Followed by:
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