Issue

When using cmdlets from powerVault e.g. Add-VaultFile the function seems to run into an endless loop. If you are using e.g. powerShell.exe or another application without user interface it is possible that this autodesk bug is the cause.


Solution

Start powerShell.exe out of the powerJobs Tools folder. If you want to use powerVault in an IDE that is not started via the shortcuts in the Tools folder you can choose one of the next solutions:

The solution Autodesk provides:

As early as possible in your Job Handler’s implementation of IJobHandler.Execute, add the following line: Autodesk.DataManagement.Client.Framework.Library.Initialize(false);

This means you have to call this fix in your powerShell like this:

[Autodesk.DataManagement.Client.Framework.Library]::Initialize($false)


Another possibility, if you are using the powershell IDE to perform debugging on your scripts would be to use the powershell ISE that has a User Interface (or other IDE's like PowerGUI Script Editor)


Other appearances of this bug

Usually after the deadlock all the functions that are using internally functionality of the VDF are crashing with similar error messages:

System.Threading.Tasks.TaskCanceledException: A task was canceled.
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
 at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
 at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
 at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback)
 at Autodesk.DataManagement.Client.Framework.Internal.ImageUtils.GetFileSystemImage(String fileName, ShellIconSize size, String key)
 at Autodesk.DataManagement.Client.Framework.Vault.Internal.PropertyExtensions.FilePropertyExtensions.PostGetPropertyValues(Connection vltConn, IEnumerable`1 entities, PropertyDefinitionDictionary propDefs, PropertyValues resultValues, PropertyValueSettings settings)
 at Autodesk.DataManagement.Client.Framework.Vault.Services.Connection.Implementation.PropertyManager.getPropertyValuesByEntityClass(String eclassId, IEnumerable`1 entities, IEnumerable`1 propDefs, PropertyValueSettings settings)
 at Autodesk.DataManagement.Client.Framework.Vault.Services.Connection.Implementation.PropertyManager.getPropertyValues(String eclassName, IEnumerable`1 entities, IEnumerable`1 propDefsToRetrieve, PropertyValueSettings settings, BackgroundWorker worker, LoadPropertiesThreadRequestArgs workerArgs)
 at Autodesk.DataManagement.Client.Framework.Vault.Services.Connection.Implementation.PropertyManager.GetPropertyValues(IEnumerable`1 entities, IEnumerable`1 propDefsToRetrieve, PropertyValueSettings settings)


In the powerShell.exe you will see errors like this: