Skip to content

NullReferenceException - When git is blocked access to a created tree object #1028

@aroden-salesforce

Description

@aroden-salesforce

When using git-tfs to import a tree antivirus (or other bloatware) blocks access to a freshly created object tree file.

Expected behavior

  • Libgit2sharp fails gracefully with error message

Bug behavior

  • Libgit2sharp fails with NullReferenceException
Failure stacktrace from git-tfs usage
 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at LibGit2Sharp.TreeEntryDefinition.From(Tree tree) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeEntryDefinition.cs:line 91
   at LibGit2Sharp.TreeDefinition.WrapAllTreeDefinitions(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 322
   at LibGit2Sharp.TreeDefinition.Build(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 284   at LibGit2Sharp.TreeDefinition.WrapAllTreeDefinitions(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 321
   at LibGit2Sharp.TreeDefinition.Build(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 284
   at LibGit2Sharp.TreeDefinition.WrapAllTreeDefinitions(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 321
   at LibGit2Sharp.TreeDefinition.Build(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 284
   at LibGit2Sharp.TreeDefinition.WrapAllTreeDefinitions(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 321
   at LibGit2Sharp.TreeDefinition.Build(Repository repository) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\TreeDefinition.cs:line 284
   at LibGit2Sharp.ObjectDatabase.CreateTree(TreeDefinition treeDefinition) in d:\g\git-tfs\lib\libgit2sharp\LibGit2Sharp\ObjectDatabase.cs:line 259
   at Sep.Git.Tfs.Core.GitTreeBuilder.GetTree() in d:\g\git-tfs\GitTfs\Core\GitTreeBuilder.cs:line 34
   at Sep.Git.Tfs.Core.GitTfsRemote.<>c__DisplayClass1e.<Apply>b__1d(ITfsWorkspace workspace) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 706
   at Sep.Git.Tfs.VsCommon.TfsHelperBase.WithWorkspace(String localDirectory, IGitTfsRemote remote, TfsChangesetInfo versionToFetch, Action`1 action)
   at Sep.Git.Tfs.Core.GitTfsRemote.WithWorkspace(TfsChangesetInfo parentChangeset, Action`1 action) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 837
   at Sep.Git.Tfs.Core.GitTfsRemote.Apply(String parent, ITfsChangeset changeset, IDictionary`2 entries, Action`1 ignorableErrorHandler) ind:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 702
   at Sep.Git.Tfs.Core.GitTfsRemote.Apply(String parent, ITfsChangeset changeset, IDictionary`2 entries) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 691
   at Sep.Git.Tfs.Core.GitTfsRemote.FetchWithMerge(Int64 mergeChangesetId, Boolean stopOnFailMergeCommit, Int32 lastChangesetIdToFetch, String[] parentCommitsHashes) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 347
   at Sep.Git.Tfs.Core.GitTfsRemote.FindRemoteAndFetch(Int32 parentChangesetId, Boolean stopOnFailMergeCommit, Boolean mergeChangeset, String& omittedParentBranch) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 534
   at Sep.Git.Tfs.Core.GitTfsRemote.FindMergedRemoteAndFetch(Int32 parentChangesetId, Boolean stopOnFailMergeCommit, String& omittedParentBranch) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 524
   at Sep.Git.Tfs.Core.GitTfsRemote.ProcessMergeChangeset(ITfsChangeset changeset, Boolean stopOnFailMergeCommit, String& parentCommit) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 398
   at Sep.Git.Tfs.Core.GitTfsRemote.FetchWithMerge(Int64 mergeChangesetId, Boolean stopOnFailMergeCommit, Int32 lastChangesetIdToFetch, String[] parentCommitsHashes) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 342
   at Sep.Git.Tfs.Core.GitTfsRemote.FetchWithMerge(Int64 mergeChangesetId, Boolean stopOnFailMergeCommit, String[] parentCommitsHashes) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 314
   at Sep.Git.Tfs.Core.GitTfsRemote.Fetch(Boolean stopOnFailMergeCommit) in d:\g\git-tfs\GitTfs\Core\GitTfsRemote.cs:line 309
   at Sep.Git.Tfs.Commands.Fetch.DoFetch(IGitTfsRemote remote, Boolean stopOnFailMergeCommit) in d:\g\git-tfs\GitTfs\Commands\Fetch.cs:line184
   at Sep.Git.Tfs.Commands.Fetch.FetchRemote(Boolean stopOnFailMergeCommit, IGitTfsRemote remote) in d:\g\git-tfs\GitTfs\Commands\Fetch.cs:line 113
   at Sep.Git.Tfs.Commands.Fetch.Run(Boolean stopOnFailMergeCommit, String[] args) in d:\g\git-tfs\GitTfs\Commands\Fetch.cs:line 105
   at Sep.Git.Tfs.Commands.Fetch.Run(String[] args) in d:\g\git-tfs\GitTfs\Commands\Fetch.cs:line 95
   at Sep.Git.Tfs.Commands.Pull.Run(String remoteId) in d:\g\git-tfs\GitTfs\Commands\Pull.cs:line 44
   at Sep.Git.Tfs.Commands.Pull.Run() in d:\g\git-tfs\GitTfs\Commands\Pull.cs:line 39
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo cultur
e)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args) in d:\g\git-tfs\GitTfs\Util\GitTfsCommandRunner.cs:line38
   at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs) in d:\g\git-tfs\GitTfs\GitTfs.cs:line 69
   at Sep.Git.Tfs.GitTfs.Run(IList`1 args) in d:\g\git-tfs\GitTfs\GitTfs.cs:line 50
   at Sep.Git.Tfs.Program.MainCore(String[] args) in d:\g\git-tfs\GitTfs\Program.cs:line 34
   at Sep.Git.Tfs.Program.Main(String[] args) in d:\g\git-tfs\GitTfs\Program.cs:line 22
Object reference not set to an instance of an object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions