Show-ADTInstallationWelcome timeout crash

When using Show-ADTInstallationWelcome and the timeout expires without any user interaction, instead of returning 1618 the toolkit crashes with the below trace. Happens with multiple executables, when triggering via a local admin or system (via ConfigMgr) account.

Trace:

[Pre-Install] :: Checking for running processes: ['T2Txp']	Get-ADTRunningProcesses	2025-12-16 3:09:43 PM	33948 (0x849C)
[Pre-Install] :: The following processes are running: ['T2Txp'].	Get-ADTRunningProcesses	2025-12-16 3:09:43 PM	33948 (0x849C)
[Pre-Install] :: Instantiating user client/server process.	Invoke-ADTClientServerOperation	2025-12-16 3:09:43 PM	33948 (0x849C)
[Pre-Install] :: Prompting the user to close application(s) ['WKCA:T2Txp']...	Show-ADTInstallationWelcome	2025-12-16 3:09:43 PM	33948 (0x849C)
[Pre-Install] :: Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
Error Record:
-------------
 
Message               : Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
InnerException        : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.InvalidCastException: Specified cast is not valid.
                           at PSADT.UserInterface.DialogManager.<>c__DisplayClass8_0`1.<ShowModalDialog>b__0() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 243
                           at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
                           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           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 PSADT.UserInterface.DialogManager.InvokeDialogAction[TResult](Func`1 callback) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 355
                           at PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 70
                           at PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState, String[] argv) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 580
                           at PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 344
                           --- End of inner exception stack trace ---
                           at PSADT.ClientServer.ServerInstance.Invoke[T](String command) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:line 622
                           at CallSite.Target(Closure , CallSite , Object , String , Object , Object )
 
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace      : at Private:Invoke-ADTClientServerOperation, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 1337
                        at Show-ADTWelcomePrompt, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19562
                        at Show-ADTInstallationWelcome<Process>, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19863
                        at Install-ADTDeployment, C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1: line 130
                        at <ScriptBlock>, C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1: line 284
                        at <ScriptBlock>, <No file>: line 1
 
PositionMessage       : At C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1:130 char:5
                        +     Show-ADTInstallationWelcome -CloseProcesses 'T2Txp'
                        +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Show-ADTInstallationWelcome	2025-12-16 3:10:14 PM	33948 (0x849C)
[Pre-Install] :: An unhandled error within [Invoke-AppDeployToolkit.ps1] has occurred.
Error Record:
-------------
 
Message               : Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
InnerException        : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.InvalidCastException: Specified cast is not valid.
                           at PSADT.UserInterface.DialogManager.<>c__DisplayClass8_0`1.<ShowModalDialog>b__0() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 243
                           at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
                           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           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 PSADT.UserInterface.DialogManager.InvokeDialogAction[TResult](Func`1 callback) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 355
                           at PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 70
                           at PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState, String[] argv) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 580
                           at PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 344
                           --- End of inner exception stack trace ---
                           at PSADT.ClientServer.ServerInstance.Invoke[T](String command) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:line 622
                           at CallSite.Target(Closure , CallSite , Object , String , Object , Object )
 
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace      : at Private:Invoke-ADTClientServerOperation, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 1337
                        at Show-ADTWelcomePrompt, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19562
                        at Show-ADTInstallationWelcome<Process>, C:\Temp\T22025.2\Ready_v4\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19863
                        at Install-ADTDeployment, C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1: line 130
                        at <ScriptBlock>, C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1: line 284
                        at <ScriptBlock>, <No file>: line 1
 
PositionMessage       : At C:\Temp\T22025.2\Ready_v4\Invoke-AppDeployToolkit.ps1:130 char:5
                        +     Show-ADTInstallationWelcome -CloseProcesses 'T2Txp'
                        +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Invoke-AppDeployToolkit.ps1	2025-12-16 3:10:14 PM	33948 (0x849C)

What version of PSADT?

Oops, forgot to mention, 4.1.7

Already resolved: [Bug] Exception calling "ShowCloseAppsDialog" · Issue #1907 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub. We'll be (hopefully) releasing 4.1.8 this week.

2 Likes

Finally I had the chance to test this and looks like the issue is still happening on 4.1.8.

I call this in the invoke.ps1 (triggered from elevated command line):

Show-ADTInstallationWelcome -CloseProcesses excel

With the Excel open I let it timeout and the log shows the same error as before:

[Pre-Install] :: An unhandled error within [invoke-appdeploytoolkit.ps1] has occurred.
Error Record:
-------------
 
Message               : Exception calling "ShowCloseAppsDialog" with "2" argument(s): "The client process returned an exception."
InnerException        : PSADT.ClientServer.ServerException: The client process returned an exception. ---> System.InvalidCastException: Specified cast is not valid.
                           at PSADT.UserInterface.DialogManager.<>c__DisplayClass8_0`1.<ShowModalDialog>b__0() in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 243
                           at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
                           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           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 PSADT.UserInterface.DialogManager.InvokeDialogAction[TResult](Func`1 callback) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 360
                           at PSADT.UserInterface.DialogManager.ShowCloseAppsDialog(DialogStyle dialogStyle, CloseAppsDialogOptions options, CloseAppsDialogState state) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.UserInterface\DialogManager.cs:line 70
                           at PSADT.ClientServer.ClientExecutable.ShowModalDialog(IReadOnlyDictionary`2 arguments, BaseState closeAppsDialogState, String[] argv) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 580
                           at PSADT.ClientServer.ClientExecutable.EnterClientServerMode(ReadOnlyDictionary`2 arguments) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Client\ClientExecutable.cs:line 344
                           --- End of inner exception stack trace ---
                           at PSADT.ClientServer.ServerInstance.Invoke[T](String command) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:line 622
                           at CallSite.Target(Closure , CallSite , Object , String , Object , Object )
 
FullyQualifiedErrorId : ServerException,Show-ADTInstallationWelcome
ScriptStackTrace      : at Private:Invoke-ADTClientServerOperation, C:\temp\psdeploytoolkitv4_4.1.8_testing\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 1337
                        at Show-ADTWelcomePrompt, C:\temp\psdeploytoolkitv4_4.1.8_testing\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19518
                        at Show-ADTInstallationWelcome<Process>, C:\temp\psdeploytoolkitv4_4.1.8_testing\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 19852
                        at Install-ADTDeployment, C:\temp\psdeploytoolkitv4_4.1.8_testing\invoke-appdeploytoolkit.ps1: line 132
                        at <ScriptBlock>, C:\temp\psdeploytoolkitv4_4.1.8_testing\invoke-appdeploytoolkit.ps1: line 298
                        at <ScriptBlock>, <No file>: line 1
 
PositionMessage       : At C:\temp\psdeploytoolkitv4_4.1.8_testing\invoke-appdeploytoolkit.ps1:132 char:5
                        +     Show-ADTInstallationWelcome -CloseProcesses excel
                        +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can you please test out a current 4.2.0 development build? A current build will be retrievable here in ~10 minutes once it's finished compiling. Fix setup issue in `ConvertTo-ADTNTAccountOrSID` that popped up all o… · PSAppDeployToolkit/PSAppDeployToolkit@4ebd575 · GitHub

If it's still occurring in this build, I'll need to know which dialog style you're using. I distinctly remember fixing this though and can confirm from a review of the code as it currently stands, that this exception should not occur.

Thanks, 4.2.0 works. Using classic UI. Re-downloaded 4.1.8 and I was able to reproduce the error. I also remember that when I did an initial test of 4.1.8 back when it got released, it worked but now seeing issues in production and also during my testing.

Given how close we are to releasing 4.2.0, I'd recommend just waiting or using the linked build for the time being. We're only held up by one remaining issue we wish to address.