Bug 11039 - NullReference when saving a csproj file
Summary: NullReference when saving a csproj file
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Mikayla Hutchinson [MSFT]
URL:
: 10758 11306 11747 ()
Depends on:
Blocks:
 
Reported: 2013-03-11 07:13 UTC by Alan McGovern
Modified: 2013-04-11 18:24 UTC (History)
6 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 Alan McGovern 2013-03-11 07:13:20 UTC
This happens when saving some csproj/sln files such as the ones in the xamarin installer solution:

Parameter name: s
  at System.IO.StringReader..ctor (System.String s) [0x00025] in /home/src/build/mono/mono/mcs/class/corlib/System.IO/StringReader.cs:56 
  at (wrapper remoting-invoke-with-check) System.IO.StringReader:.ctor (string)
  at Mono.Xml2.XmlTextReader..ctor (System.String xmlFragment, XmlNodeType fragType, System.Xml.XmlParserContext context) [0x00000] in /home/src/build/mono/mono/mcs/class/System.XML/System.Xml/XmlTextReader.cs:154 
  at System.Xml.XmlTextReader..ctor (System.String xmlFragment, XmlNodeType fragType, System.Xml.XmlParserContext context) [0x00006] in /home/src/build/mono/mono/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:132 
  at System.Xml.XmlElement.set_InnerXml (System.String value) [0x0006f] in /home/src/build/mono/mono/mcs/class/System.XML/System.Xml/XmlElement.cs:152 
  at MonoDevelop.Projects.Formats.MSBuild.MSBuildProperty.set_Value (System.String value) [0x00008] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProject.cs:437 
  at MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler.SetIfPresentOrNotDefaultValue (MSBuildPropertySet propGroup, System.String name, System.String value, System.String defaultValue) [0x0000f] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs:1159 
  at MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler.SaveItem (IProgressMonitor monitor) [0x00ca6] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs:1117 
  at MonoDevelop.Projects.Formats.MSBuild.MSBuildHandler.Save (IProgressMonitor monitor) [0x00081] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildHandler.cs:128 
  at MonoDevelop.Projects.SolutionEntityItem.OnSave (IProgressMonitor monitor) [0x00008] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionEntityItem.cs:306 
  at MonoDevelop.Projects.DotNetProject.OnSave (IProgressMonitor monitor) [0x00028] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:726 
  at MonoDevelop.Projects.DefaultProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem entry) [0x00001] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:647 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Autotools.MakefileProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem entry) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.CompiledAssemblyExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x00000] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs:228 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.ProjectServiceExtension.Save (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item) [0x0000a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:67 
  at MonoDevelop.Projects.SolutionEntityItem.Save (IProgressMonitor monitor) [0x0003a] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionEntityItem.cs:253 
  at MonoDevelop.Projects.Formats.MSBuild.SlnFileFormat.WriteProjects (MonoDevelop.Projects.SolutionFolder folder, System.String baseDirectory, System.IO.StreamWriter writer, Boolean saveProjects, IProgressMonitor monitor) [0x00066] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs:226 
  at MonoDevelop.Projects.Formats.MSBuild.SlnFileFormat.WriteFileInternal (System.String file, MonoDevelop.Projects.Solution solution, System.String baseDir, MonoDevelop.Projects.Formats.MSBuild.MSBuildFileFormat format, Boolean saveProjects, IProgressMonitor monitor) [0x0008e] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs:133 
  at MonoDevelop.Projects.Formats.MSBuild.SlnFileFormat.WriteFile (System.String file, System.Object obj, MonoDevelop.Projects.Formats.MSBuild.MSBuildFileFormat format, Boolean saveProjects, IProgressMonitor monitor) [0x0006f] in /home/src/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs:93
Comment 1 Alan McGovern 2013-03-11 07:19:56 UTC
I worked around this particular issue with https://github.com/mono/monodevelop/commit/d61210fd7f3d31073b82abe3a4aaba4587a3854c . I'm unsure if we're completely robust when dealing with new values which are null though, so I'm leaving this open until mhutch can review/fix my commit as necessary
Comment 2 Mikayla Hutchinson [MSFT] 2013-03-12 17:46:17 UTC
Landed a real fix.
Comment 3 Jeffrey Stedfast 2013-03-20 18:13:03 UTC
*** Bug 11306 has been marked as a duplicate of this bug. ***
Comment 4 Mikayla Hutchinson [MSFT] 2013-03-20 19:59:36 UTC
*** Bug 10758 has been marked as a duplicate of this bug. ***
Comment 5 Nischal 2013-03-26 03:57:54 UTC
Today we have checked this issue with following builds:

X.S 4.0.3.13
Xamarin.Android 4.6.02000

We have checked following things:

1. We have changed code formatting option and it is working fine.

2. We have saved .csproject file after making some changing in .cs file and it is working fine

3.  When we open project which is mentioned in Bug 11306 and rename the project name then we are getting a dialog popup ' which is showing 'Could not save solution...Argument can not be null. But solution get saved with renamed project.

http://screencast.com/t/KbWAuawFpyzZ

However when we create any solution having more than one project and rename the project, solution gets saved without giving any error.

So reopening this issue because getting error dialog popup for 'MvvmCross_NoSamples.sln' attached in Bug 11306
Comment 6 Mikayla Hutchinson [MSFT] 2013-03-28 20:53:49 UTC
The fix was not in 4.0.3. 4.0.3 was branched before this fix and the fix was not backported.
Comment 7 Chris Howie 2013-03-30 03:21:39 UTC
Is there a particular commit (or set of commits) that can be cherry-picked on to the 4.0.3 tag to resolve this issue?  This is affecting me and there doesn't seem to be a workaround.
Comment 9 Chris Howie 2013-04-05 22:41:53 UTC
Thanks, Michael.  That did the trick.
Comment 10 Mikayla Hutchinson [MSFT] 2013-04-11 18:24:52 UTC
*** Bug 11747 has been marked as a duplicate of this bug. ***