Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Open on GitHub/Copy Link to Clipboard fails when tracking branch has been deleted #1780

@grokys

Description

@grokys

When trying to run Open on GitHub/Copy Link to Clipboard on a branch whose tracking branch has been deleted, the following exception occurs:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=GitHub.Exports
  StackTrace:
   at GitHub.Services.GitService.<>c__DisplayClass6_0.<GetLatestPushedSha>b__0() in D:\projects\github\VisualStudio\src\GitHub.Exports\Services\GitService.cs:line 101
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

This happens because repo.Head.TrackedBranch.Tip is null at:

https://github.com/github/VisualStudio/blob/master/src/GitHub.Exports/Services/GitService.cs?utf8=%E2%9C%93#L101

The commands fail silently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions