Bug 5917 - Adding New Files (ViewController, XML, etc) Causes NullReferenceException in MonoDevelop
Summary: Adding New Files (ViewController, XML, etc) Causes NullReferenceException in ...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: 3.0.x
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-06-29 01:16 UTC by Will
Modified: 2012-11-21 07:24 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Will 2012-06-29 01:16:38 UTC
Trying to add any new file to my existing project causes an exception.  It is not happening with a newly created Solution.


System.NullReferenceException: Object reference not set to an instance of an object
  at Sharpen.FilePath..ctor (Sharpen.FilePath other, System.String child) [0x00000] in <filename unknown>:0 
  at NGit.Util.FS.Resolve (Sharpen.FilePath dir, System.String name) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator+RootIgnoreNode.Load () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.GetIgnoreNode () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnoredInternal (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnored (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnored () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.Filter.IndexDiffFilter.Include (NGit.Treewalk.TreeWalk tw) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.Filter.AndTreeFilter+List.Include (NGit.Treewalk.TreeWalk walker) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.TreeWalk.Next () [0x00000] in <filename unknown>:0 
  at NGit.IndexDiff.Diff (NGit.ProgressMonitor monitor, Int32 estWorkTreeSize, Int32 estIndexSize, System.String title) [0x00000] in <filename unknown>:0 
  at NGit.IndexDiff.Diff () [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.FilteredStatus.Call () [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.GitRepository.GetDirectoryVersionInfo (FilePath localDirectory, IEnumerable`1 localFileNames, Boolean getRemoteStatus, Boolean recursive) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.GitRepository.OnGetVersionInfo (IEnumerable`1 paths, Boolean getRemoteStatus) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Repository+<GetVersionInfo>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator35`1[MonoDevelop.VersionControl.VersionInfo].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator27`2[MonoDevelop.VersionControl.VersionInfo,MonoDevelop.Core.FilePath].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[MonoDevelop.Core.FilePath].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[MonoDevelop.Core.FilePath]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.ToArray[FilePath] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.VersionControlService.OnFileAdded (System.Object s, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Ide.RootWorkspace.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at __ProjectFileEventHandler_DelegateFactory_3.Dispatch (System.Object ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.GuiSyncContext.AsyncDispatch (MonoDevelop.Ide.StatefulMessageHandler cb, System.Object ob) [0x00000] in <filename unknown>:0 
  at __ProjectFileEventHandler_DelegateFactory_3.ProxyCall (System.Object , MonoDevelop.Projects.ProjectFileEventArgs ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Solution.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Projects.Project.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at MonoDevelop.IPhone.IPhoneProject.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.NotifyFileAddedToProject (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.DotNetProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.IPhone.IPhoneProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].MonoDevelop.Projects.IItemListHandler.InternalAdd (IEnumerable`1 objs, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].OnItemAdded (MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ItemCollection`1[MonoDevelop.Projects.ProjectFile].InsertItem (Int32 index, MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at System.Collections.ObjectModel.Collection`1[MonoDevelop.Projects.ProjectFile].Add (MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.AddFile (System.String filename, System.String buildAction) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.FileTemplate.CreateFile (MonoDevelop.Ide.Templates.FileDescriptionTemplate newfile, MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.FileTemplate.Create (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Projects.NewFileDialog.OpenEvent (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
Comment 1 Alan McGovern 2012-06-29 17:06:05 UTC
Would you be able to give someone access to the repository which triggers this issue? It looks like it's something in one of your .gitignore files which is triggering the bug so we'll need a copy of it in order to diagnose and resolve the problem
Comment 2 Will 2012-06-29 17:16:34 UTC
It appears to be happening to any project using Git.  I just opened an old MonoTouch.Dialog-f4d150e solution and tried to add an XML file and got the same exception:

System.NullReferenceException: Object reference not set to an instance of an object
  at Sharpen.FilePath..ctor (Sharpen.FilePath other, System.String child) [0x00000] in <filename unknown>:0 
  at NGit.Util.FS.Resolve (Sharpen.FilePath dir, System.String name) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator+RootIgnoreNode.Load () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.GetIgnoreNode () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnoredInternal (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnored (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnoredInternal (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnored (Int32 pLen) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.WorkingTreeIterator.IsEntryIgnored () [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.Filter.IndexDiffFilter.Include (NGit.Treewalk.TreeWalk tw) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.Filter.AndTreeFilter+List.Include (NGit.Treewalk.TreeWalk walker) [0x00000] in <filename unknown>:0 
  at NGit.Treewalk.TreeWalk.Next () [0x00000] in <filename unknown>:0 
  at NGit.IndexDiff.Diff (NGit.ProgressMonitor monitor, Int32 estWorkTreeSize, Int32 estIndexSize, System.String title) [0x00000] in <filename unknown>:0 
  at NGit.IndexDiff.Diff () [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.FilteredStatus.Call () [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.GitRepository.GetDirectoryVersionInfo (FilePath localDirectory, IEnumerable`1 localFileNames, Boolean getRemoteStatus, Boolean recursive) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Git.GitRepository.OnGetVersionInfo (IEnumerable`1 paths, Boolean getRemoteStatus) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.Repository+<GetVersionInfo>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator35`1[MonoDevelop.VersionControl.VersionInfo].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator27`2[MonoDevelop.VersionControl.VersionInfo,MonoDevelop.Core.FilePath].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[MonoDevelop.Core.FilePath].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[MonoDevelop.Core.FilePath]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.ToArray[FilePath] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at MonoDevelop.VersionControl.VersionControlService.OnFileAdded (System.Object s, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Ide.RootWorkspace.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at __ProjectFileEventHandler_DelegateFactory_3.Dispatch (System.Object ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.GuiSyncContext.AsyncDispatch (MonoDevelop.Ide.StatefulMessageHandler cb, System.Object ob) [0x00000] in <filename unknown>:0 
  at __ProjectFileEventHandler_DelegateFactory_3.ProxyCall (System.Object , MonoDevelop.Projects.ProjectFileEventArgs ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Solution.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Projects.Project.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in <filename unknown>:0 
  at MonoDevelop.IPhone.IPhoneProject.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.NotifyFileAddedToProject (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.DotNetProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.IPhone.IPhoneProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].MonoDevelop.Projects.IItemListHandler.InternalAdd (IEnumerable`1 objs, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].OnItemAdded (MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ItemCollection`1[MonoDevelop.Projects.ProjectFile].InsertItem (Int32 index, MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at System.Collections.ObjectModel.Collection`1[MonoDevelop.Projects.ProjectFile].Add (MonoDevelop.Projects.ProjectFile item) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Project.AddFile (System.String filename, System.String buildAction) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.FileTemplate.CreateFile (MonoDevelop.Ide.Templates.FileDescriptionTemplate newfile, MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Templates.FileTemplate.Create (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Projects.NewFileDialog.OpenEvent (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
Comment 3 Alan McGovern 2012-06-29 17:25:08 UTC
What version of MonoDevelop are you using? I cannot reproduce the problem with that revision of MonoTouch.Dialog. Are you sure you have no local changes? Is it possible that your .gitignore has been corrupted because of a merge conflict?
Comment 4 Will 2012-07-02 10:22:08 UTC
Happens with any project under version control.  Is there a way to reset my MonoDevelop settings to default so I can see if that resolves the issue?

MonoDevelop 3.0.3.2
Installation UUID: 73791424-14bf-42bd-b8a7-83cc859ce38f
Runtime:
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (2.12.0.0)
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.3.3 (1178)
	 Build 4E3002
Monotouch: 5.2.12
Mono for Android not installed
Build information:
	Release ID: 30003002
	Git revision: 7bf6ac0ca43c1b12703176ad9933c3484c05c84c-dirty
	Build date: 2012-06-16 04:36:10+0000
	Xamarin addins: 62ad7268d38c2ece7e00dc32960bd3bdab8fec38
Operating System:
	Mac OS X 10.7.4
	Darwin will-mba.local 11.4.0 Darwin Kernel Version 11.4.0
	    Mon Apr  9 19:32:15 PDT 2012
	    root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
Comment 5 Alan McGovern 2012-08-17 11:14:42 UTC
Is your filesystem different to normal? Have you symlinked the directory which contains your solution, or is it on a shared network filesystem?
Comment 6 Alan McGovern 2012-11-21 07:24:18 UTC
I have not been able to reproduce the issue and there has been no further information provided.  As such I'm closing this bug. If there is still a way to reproduce this in newer builds of MonoDevelop do let me know.