Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DefectID: 39207] Environment Application name is changed after Target Application name is changed #3702

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Ginger/Ginger/SolutionWindows/TargetApplicationsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ limitations under the License.
using Ginger.UserControls;
using Ginger.UserControlsLib;
using GingerCore;
using GingerCore.Environments;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary import statement.

The import statement using GingerCore.Environments; is not used in the code. Consider removing it to keep the code clean and maintainable.

- using GingerCore.Environments;

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
using GingerCore.Environments;

using GingerCore.Platforms;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using System.Collections.Generic;
Expand Down Expand Up @@ -224,6 +225,19 @@ private void UpdateApplicationNameChangeInSolution(ApplicationPlatform app)
}
}

foreach(ProjEnvironment projEnv in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<ProjEnvironment>())
{
foreach (EnvApplication envApplication in projEnv.Applications)
{

if(string.Equals(envApplication.Name, app.NameBeforeEdit))
{
projEnv.StartDirtyTracking();
envApplication.Name = app.AppName;
}
}
}

Comment on lines +228 to +240
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper error handling and logging.

The new logic for updating application names in project environments does not include error handling or logging. Consider adding error handling to manage potential issues and logging to track changes for debugging purposes.

try
{
    foreach (ProjEnvironment projEnv in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<ProjEnvironment>())
    {
        foreach (EnvApplication envApplication in projEnv.Applications)
        {
            if (string.Equals(envApplication.Name, app.NameBeforeEdit))
            {
                projEnv.StartDirtyTracking();
                envApplication.Name = app.AppName;
            }
        }
    }
}
catch (Exception ex)
{
    Reporter.ToUser(eUserMsgKey.StaticErrorMessage, $"An error occurred while updating application names: {ex.Message}");
    // Optionally log the exception
}

if(numOfAfectedItems > 0 && OnActivityUpdate!=null)
{
OnActivityUpdate();
Expand Down
Loading