powerVault runs in an endless loop

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 or your preferred IDE and choose one of the next solutions:

The solution Autodesk provides:

As early as possible in your script, add the following line: Autodesk.DataManagement.Client.Framework.Library.Initialize(false):

[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 functionality of the VDF internally 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: