Use 'using' statement for InstancesForm disposal

Replaces manual disposal of InstancesForm with a 'using' statement to ensure proper resource management and exception safety when recording to the metadata database.
This commit is contained in:
Namhyeon Go 2025-11-20 17:31:50 +09:00
parent 4bd05fd2a2
commit 2e92255a3c

View File

@ -90,7 +90,8 @@ namespace WelsonJS.Launcher
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
// record to the metadata database // record to the metadata database
InstancesForm instancesForm = new InstancesForm(); using (InstancesForm instancesForm = new InstancesForm())
{
try try
{ {
instancesForm.GetDatabaseInstance().Insert(new Dictionary<string, object> instancesForm.GetDatabaseInstance().Insert(new Dictionary<string, object>
@ -103,7 +104,7 @@ namespace WelsonJS.Launcher
{ {
_logger.Error($"Failed to record first deploy time: {ex.Message}"); _logger.Error($"Failed to record first deploy time: {ex.Message}");
} }
instancesForm.Dispose(); }
// record to the instance directory // record to the instance directory
try try