Skip to content

Remove dead code in StopJob.cs (line 164) #1696

Closed

Description

Jason found this through code inspection. This code will never run because of the previous if statement and in fact the code is duplicated in the HandleStopJobCompleted() where it is correct. So we can simply remove the code at line 164.

var parentJob = job as ContainerParentJob;
if (parentJob != null && parentJob.ExecutionError.Count > 0)
{
    foreach (
        var e in
            parentJob.ExecutionError.Where(
                e => e.FullyQualifiedErrorId == "ContainerParentJobStopError"))
    {
        WriteError(e);
    }
}

Activity

  1. added
    WG-Engine
    on Aug 11, 2016
  2. added this to the milestone on Aug 11, 2016
  3. removed this from the milestone on May 23, 2017
  4. joeyaiello commented on May 23, 2017

    @joeyaiello
    Contributor

    If we have a "code cleanup" label at some point, this would fall under it.

  5. added
    Up-for-Grabs
    on May 23, 2017
  6. added
    Issue-Code Cleanup
    on Jun 1, 2017
  7. travisty- commented on Oct 12, 2017

    @travisty-
    Contributor

    Hi PowerShell Team (@PowerShell), I just submit a PR (#5091) for this issue.

  8. dantraMSFT commented on Oct 12, 2017

    @dantraMSFT
    Contributor

    Paul Higinbotham (@PaulHigin) I seem to be missing something with this issue and the associated PR. HandleStopJobCompleted appears to be only used for Job2 instances and not Job instances. While the code is duplicated, removing it for Job instances doesn't appear to be correct.

    Paul explained it to me off line. Job does not derive from ContainerParentJob so, other than the job.StopJob() statement, the rest of the else cause is dead code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code CleanupResolution-FixedUp-for-GrabsWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions