Bug 39712 - Adding a new file to a directory causes an exception
Summary: Adding a new file to a directory causes an exception
Status: RESOLVED DUPLICATE of bug 39591
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: 6.0.0 (C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: master
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-17 09:12 UTC by Paul Johnson
Modified: 2016-03-17 10:19 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 DUPLICATE of bug 39591

Description Paul Johnson 2016-03-17 09:12:43 UTC
I have created a directory in any of my projects. I then go to add a new file and the IDE throws the following error

System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.Ide.Gui.Document.get_Name () [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:328 
  at MonoDevelop.Xml.Editor.BaseXmlEditorExtension.<HandleProjectChanged>m__1 (MonoDevelop.Projects.ProjectFileEventInfo f) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs:110 
  at System.Linq.Enumerable.Any[TSource] (IEnumerable`1 source, System.Func`2 predicate) [0x00035] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:1177 
  at MonoDevelop.Xml.Editor.BaseXmlEditorExtension.HandleProjectChanged (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs:110 
  at (wrapper delegate-invoke) <Module>:invoke_void_object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Ide.RootWorkspace.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x0000b] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:1007 
  at MonoDevelop.Projects.Solution.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x0000b] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:1021 
  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00016] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:933 
  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:800 
  at (wrapper delegate-invoke) <Module>:invoke_void_object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Projects.Project.DoOnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00012] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2871 
  at MonoDevelop.Projects.Project+DefaultMSBuildProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:3028 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.IPhone.IPhoneProjectFlavor.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00241] in /Users/builder/data/lanes/2920/f73f730c/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneProject.cs:1670 
  at MonoDevelop.Projects.ProjectExtension.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:212 
  at MonoDevelop.Projects.Project.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2865 
  at MonoDevelop.Projects.Project.NotifyFileAddedToProject (IEnumerable`1 objs) [0x00061] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1986 
  at MonoDevelop.Projects.Project.OnItemsAdded (IEnumerable`1 objs) [0x00096] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1920 
  at MonoDevelop.Projects.DotNetProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1432 
  at MonoDevelop.Projects.Project+DefaultMSBuildProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:3093 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.IPhone.IPhoneProjectFlavor.OnItemsAdded (IEnumerable`1 objs) [0x000e8] in /Users/builder/data/lanes/2920/f73f730c/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneProject.cs:522 
  at MonoDevelop.Projects.ProjectExtension.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:197 
  at MonoDevelop.Projects.Project.NotifyItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1900 
  at MonoDevelop.Projects.ProjectItemCollection`1[T].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x0009a] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:150 
  at MonoDevelop.Projects.ProjectItemCollection`1[T].MonoDevelop.Projects.IItemListHandler.InternalAdd (IEnumerable`1 items, Boolean comesFromParent) [0x00020] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:120 
  at MonoDevelop.Projects.ProjectItemCollection`1[T].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00082] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:148 
  at MonoDevelop.Projects.ProjectItemCollection`1[T].OnItemsAdded (IEnumerable`1 items) [0x00013] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:98 
  at MonoDevelop.Projects.ProjectFileCollection.OnItemsAdded (IEnumerable`1 items) [0x00037] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFileCollection.cs:194 
  at MonoDevelop.Projects.ItemCollection`1[T].Add (MonoDevelop.Projects.T item) [0x00012] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemCollection.cs:64 
  at MonoDevelop.Projects.Project.AddFile (System.String filename, System.String buildAction) [0x00069] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1331 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject (MonoDevelop.Projects.SolutionFolderItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00038] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:121 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject (MonoDevelop.Projects.SolutionFolderItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00000] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:113 
  at MonoDevelop.Ide.Templates.FileTemplate.CreateFile (MonoDevelop.Ide.Templates.FileDescriptionTemplate newfile, MonoDevelop.Projects.SolutionFolderItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00019] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs:313 
  at MonoDevelop.Ide.Templates.FileTemplate.Create (MonoDevelop.Projects.SolutionFolderItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x0002b] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs:254 
  at MonoDevelop.Ide.Projects.NewFileDialog.OpenEvent (System.Object sender, System.EventArgs e) [0x000ab] in /Users/builder/data/lanes/2920/f73f730c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs:492 

The file is there and will show if I click on Cancel in the new file template window.

=== Xamarin Studio ===

Version 6.0 (build 4801)
Installation UUID: f3d1a29c-1ba2-4a83-a193-1087efe91a85
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/f8474c4) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000040

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.2.1 (9548.1)
Build 7C1002

=== Xamarin.iOS ===

Version: 9.8.0.58 (Business Edition)
Hash: fa3b68c
Branch: master
Build date: 2016-03-09 11:44:54-0500

=== Xamarin.Android ===

Version: 6.1.0.16 (Business Edition)
Android SDK: /Users/PFJ/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.8.0.58 (Starter Edition)

=== Build Information ===

Release ID: 600004801
Git revision: f73f730c738baf8701a5892b7af64fd468d1dc0c
Build date: 2016-03-14 14:28:06-04
Xamarin addins: 3af7be6c701eb0137645a03e38b82f23b65738c3
Build lane: monodevelop-lion-cycle7

=== Operating System ===

Mac OS X 10.11.4
Darwin Pauls-iMac.local 15.4.0 Darwin Kernel Version 15.4.0
    Fri Feb 26 21:17:08 PST 2016
    root:xnu-3248.40.184~2/RELEASE_X86_64 x86_64
Comment 1 Matt Ward 2016-03-17 09:42:23 UTC
This has been fixed in 6.0.0.4826. It can be triggered by opening the Android manifest.xml file into the editor and not switching to the .xml source document.

*** This bug has been marked as a duplicate of bug 39591 ***
Comment 2 Paul Johnson 2016-03-17 10:09:24 UTC
I'm getting this if I'm editing the iOS or PCL within a PCL application when the device type is set to just Debug and Android is set as the start project.
Comment 3 Matt Ward 2016-03-17 10:19:28 UTC
With Xamarin Studio having just been closed and re-opened can you provide the exact steps to repro this? If you have not touched the manifest.xml file I am wondering if you have triggered this problem via another path. Bug #39591 was fixed in the android manifest editor so it will have no affect if you are not using that.