Bug 13156 - Cannot have folders with & in the name
Summary: Cannot have folders with & in the name
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: 4.0.9
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2013-07-10 15:31 UTC by Jeffrey Stedfast
Modified: 2014-01-21 06:15 UTC (History)
4 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:
VERIFIED FIXED

Description Jeffrey Stedfast 2013-07-10 15:31:45 UTC
From a customer:

The solution cannot handle folder names with '&' in them. I presume you're failing to escape such characters when writing the project files as XML. If you attempt to import a folder with such a name, it imports some files, fails on the problematic one, then shows an error dialog every time it attempts to save the solution from then onwards. Basically any subsequent changes will be lost.
Comment 1 Ashley 2013-07-10 20:07:55 UTC
Creating a file or folder with '&' in the name appears to work correctly if you do it directly through the solution explorer. The way I caused this error, and which I can still reproduce, is:

1) Create a folder OUTSIDE of the root of solution, with a name containing '&'. Make sure it contains at least one source file.

2) Right click project -> Add -> Add Existing Folder...

3) Select the folder, and choose to add at least one file from it

4) Xamarin Studio tells you that the file is outside the project's root directory, and asks what you'd like to do. Choose to 'Add a link to the file'

5) Every attempt to save the solution will now fail with an error dialog.

Given stack trace is:

System.Xml.XmlException: An error occurred while parsing EntityName. Line 1, position 4.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseEntityName()
   at System.Xml.XmlTextReaderImpl.ParseEntityReference()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.ParsePartialContent(XmlNode parentNode, String innerxmltext, XmlNodeType nt)
   at System.Xml.XmlElement.set_InnerXml(String value)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildItem.SetMetadata(String name, String value, Boolean isLiteral)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildItem.SetMetadata(String name, String value)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler.SaveProjectFile(MSBuildSerializer ser, MSBuildProject msproject, ProjectFile file, Dictionary`2 oldItems)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler.SaveItem(IProgressMonitor monitor, MSBuildSerializer ser, MSBuildProject msproject, Object ob, Dictionary`2 oldItems)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler.SaveItem(IProgressMonitor monitor)
   at MonoDevelop.Projects.Formats.MSBuild.MSBuildHandler.Save(IProgressMonitor monitor)
   at MonoDevelop.Projects.SolutionEntityItem.OnSave(IProgressMonitor monitor)
   at MonoDevelop.Projects.DotNetProject.OnSave(IProgressMonitor monitor)
   at MonoDevelop.Projects.DefaultProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem entry)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.CompiledAssemblyExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.ProjectServiceExtension.Save(IProgressMonitor monitor, SolutionEntityItem item)
   at MonoDevelop.Projects.SolutionEntityItem.Save(IProgressMonitor monitor)
   at MonoDevelop.MonoDroid.MonoDroidProject.Save(IProgressMonitor monitor)
   at MonoDevelop.Ide.ProjectOperations.Save(IEnumerable`1 items)
Comment 2 Lluis Sanchez 2013-07-11 13:22:25 UTC
The fix will be included in upcoming releases.
Comment 3 Nischal 2014-01-21 06:15:37 UTC
We have checked this issue with the steps mentioned in comment 1 and it is working fine. File outside root of solution is added successfully. 
Screencast: http://screencast.com/t/2h47rtU1trd

Please review and let us know if you have any other directions/suggestions to verify this issue.

Environment info:
Xamarin Studio
Version 4.2.3 (build 146)
Git revision: 76e7c7f6ca0e59052f2bb29f8179313510977377

Xam.Android 4.13.0-4 (window master)