Falha no instalador quando ocorre um erro nos comandos SQL

Durante a instalação do Latromi Server, quando acontece um erro inesperado no momento de aplicação dos scripts de banco de dados, o instalador fica travado durante algum tempo até que aparece a mensagem de erro abaixo:

No caso registrado o erro havia ocorrido ao aplicar o script da versão de banco de dados 3.5.78, ao executar o comando que instala a extensão pgcrypto:

CREATE EXTENSION IF NOT EXISTS pgcrypto;

ERROR: could not open extension control file “/usr/share/pgsql/extension/pgcrypto.control”: No such file or directory

Mensagem registrada no arquivo de Log:

2025-02-16 15:42:25  Error    LatromiInstSVC        --                        --     --               Npgsql.PostgresException (0x80004005): 58P01: could not open extension control file "/usr/share/pgsql/extension/pgcrypto.control": No such file or directory      at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()   --- End of stack trace from previous location where exception was thrown ---      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()      at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()   --- End of stack trace from previous location where exception was thrown ---      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)      at System.Threading.Tasks.ValueTask`1.get_Result()      at Npgsql.NpgsqlDataReader.<NextResult>d__46.MoveNext()   --- End of stack trace from previous location where exception was thrown ---      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)      at Npgsql.NpgsqlDataReader.NextResult()      at Npgsql.NpgsqlCommand.<ExecuteNonQuery>d__92.MoveNext()   --- End of stack trace from previous location where exception was thrown ---      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)      at Npgsql.NpgsqlCommand.ExecuteNonQuery()      at LATROMI.Install.Server.DataBaseHelper.ExecuteSql(String sql)      at LATROMI.Install.Server.DataBaseInstaller.<InstallTaskAsyncPrivate>d__17.MoveNext()      [Npgsql.PostgresException]         Message:   58P01: could not open extension control file "/usr/share/pgsql/extension/pgcrypto.control": No such file or directory      Source:   Npgsql      Severity:   ERROR      SqlState:   58P01      Code:   58P01      MessageText:   could not open extension control file "/usr/share/pgsql/extension/pgcrypto.control": No such file or directory      Where:   SQL statement "CREATE EXTENSION IF NOT EXISTS pgcrypto"   PL/pgSQL function _tmp_upgrade_20220803123118() line 5 at SQL statement      File:   extension.c      Line:   496      Routine:   parse_extension_control_file   
    Npgsql.PostgresException (0x80004005): 58P01: could not open extension control file "/usr/share/pgsql/extension/pgcrypto.control": No such file or directory
       at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Threading.Tasks.ValueTask`1.get_Result()
       at Npgsql.NpgsqlDataReader.<NextResult>d__46.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Npgsql.NpgsqlDataReader.NextResult()
       at Npgsql.NpgsqlCommand.<ExecuteNonQuery>d__92.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Npgsql.NpgsqlCommand.ExecuteNonQuery()
       at LATROMI.Install.Server.DataBaseHelper.ExecuteSql(String sql)
       at LATROMI.Install.Server.DataBaseInstaller.<InstallTaskAsyncPrivate>d__17.MoveNext()

    at LATROMI.Install.Server.DataBaseInstaller.<InstallTaskAsyncPrivate>d__17.MoveNext()
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
       at LATROMI.Install.Server.DataBaseInstaller.InstallTaskAsyncPrivate()
       at LATROMI.Install.Server.DataBaseInstaller.<InstallTaskAsync>d__16.MoveNext()
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
       at LATROMI.Install.Server.DataBaseInstaller.InstallTaskAsync()
       at LATROMI.Install.MultiInstaller.<InstallAsync>d__49.MoveNext()
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
       at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
       at System.Threading.Tasks.Task.FinishContinuations()
       at System.Threading.Tasks.Task.FinishStageThree()
       at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
       at System.Threading.Tasks.Task.DelayPromise.Complete()
       at System.Threading.Tasks.Task.<>c.<Delay>b__274_1(Object state)
       at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireQueuedTimerCompletion(Object state)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Ao clicar no botão “OK” aparece este outro erro:

Detalhes do erro:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
   at LATROMI.ServerSetup.Program.<>c.<Install>b__5_0(MultiInstallerCompleteEventArgs e)
   at LATROMI.SetupUI.Facade.<>c__DisplayClass1_0.<StartMultiInstaller>b__0(Object sender, MultiInstallerCompleteEventArgs e)
   at LATROMI.SetupUI.WinForms.MultiInstallerDialog.OnComplete(AppInstallerResult installerResult)
   at LATROMI.SetupUI.WinForms.MultiInstallerDialog.<>c__DisplayClass16_0.<DownloadAndInstall>b__6(Object obj)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4775.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
4j3y24vn.ybz
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Administrator/Downloads/latromi-server-setup.exe
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4770.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4739.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4380.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4762.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Web
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4770.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.ServiceProcess
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceProcess/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll
----------------------------------------
System.ServiceModel
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4729.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel/v4.0_4.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4729.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4435.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
SMDiagnostics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4729.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/SMDiagnostics/v4.0_4.0.0.0__b77a5c561934e089/SMDiagnostics.dll
----------------------------------------
System.ServiceModel.Internals
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4729.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel.Internals/v4.0_4.0.0.0__31bf3856ad364e35/System.ServiceModel.Internals.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.IdentityModel
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4729.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.IdentityModel/v4.0_4.0.0.0__b77a5c561934e089/System.IdentityModel.dll
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.