Bug 40945 - NREX when modifying project/solution properties
Summary: NREX when modifying project/solution properties
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.5.X
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-05-06 18:01 UTC by Marek Habersack
Modified: 2016-05-10 15:43 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 GitHub or Developer Community 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 Marek Habersack 2016-05-06 18:01:44 UTC
XS master/b2b236de795cb33bacfaeb19b00071ee84b5be6d
Mono JIT compiler version 4.5.1 (master/d36d166 Fri  6 May 11:58:33 CEST 2016)
Ubuntu 16.04 64-bit

When any action is taken which changes the project/solution status and requires saving it to disk, the following exception is thrown (reproducible using https://github.com/xamarin/xamarin-android/)

ERROR [2016-05-05 19:09:05Z]: Save failed.
System.InvalidCastException: Invalid cast from 'System.String' to 'MonoDevelop.Core.FilePath'.
  at System.Convert.DefaultToType (System.IConvertible value, System.Type targetType, System.IFormatProvider provider) [0x00281] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/convert.cs:318 
  at System.String.System.IConvertible.ToType (System.Type type, System.IFormatProvider provider) [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/string.cs:3402 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x0025a] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/convert.cs:381 
  at MonoDevelop.Projects.MSBuild.MSBuildPropertyCore.GetValue (System.Type t) [0x00094] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyCore.cs:70 
  at MonoDevelop.Projects.MSBuild.MSBuildPropertyGroup.SetValue (System.String name, System.Object value, System.Object defaultValue, System.Boolean mergeToMainGroup, System.String condition) [0x00025] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs:346 
  at MonoDevelop.Projects.MSBuild.MSBuildEvaluatedPropertyCollection.MonoDevelop.Projects.IPropertySet.SetValue (System.String name, System.Object value, System.Object defaultValue, System.Boolean mergeToMainGroup, System.String condition) [0x00006] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs:214 
  at MonoDevelop.Projects.ProjectConfiguration.Write (MonoDevelop.Projects.IPropertySet pset) [0x000a0] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs:105 
  at MonoDevelop.Projects.DotNetProjectConfiguration.Write (MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs:75 
  at MonoDevelop.Projects.Project.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2620 
  at MonoDevelop.Projects.DotNetProject.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1617 
  at MonoDevelop.Projects.Project+DefaultMSBuildProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet grp) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:3065 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.ProjectExtension.OnWriteConfiguration (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ProjectConfiguration config, MonoDevelop.Projects.IPropertySet pset) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:125 
  at MonoDevelop.Projects.Project.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00186] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2548 
  at MonoDevelop.Projects.DotNetProject.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1595 
  at MonoDevelop.Projects.Project+DefaultMSBuildProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:3055 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.Projects.SharedAssetsProjects.SharedAssetsProjectMSBuildExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject project) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs:65 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.PackageManagement.PackageManagementMSBuildExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00007] in /home/grendel/vc/mono/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementMSBuildExtension.cs:42 
  at MonoDevelop.Projects.ProjectExtension.OnWriteProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:118 
  at MonoDevelop.Projects.Project.WriteProject (MonoDevelop.Core.ProgressMonitor monitor) [0x00042] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2073 
  at MonoDevelop.Projects.Project+<WriteProjectAsync>c__async10+<WriteProjectAsync>c__AnonStorey32.<>m__0 () [0x00000] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2054 
  at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2879 
  at System.Threading.Tasks.Task.Execute () [0x00016] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at MonoDevelop.Projects.Project+<WriteProjectAsync>c__async10.MoveNext () [0x000c8] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2053 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Projects.Project+<OnSave>c__async4.MoveNext () [0x00042] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:533 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Projects.SolutionItem+<DoSave>c__async3.MoveNext () [0x00067] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs:442 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Projects.SolutionItem+<SaveAsync>c__AnonStorey1C+<SaveAsync>c__AnonStorey1D+<SaveAsync>c__async1B.MoveNext () [0x000c0] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs:424 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /home/grendel/tmp/build/mono/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Ide.ProjectOperations+<SaveAsyncInernal>c__async4.MoveNext () [0x00110] in /home/grendel/vc/mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:414
Comment 1 Lluis Sanchez 2016-05-09 07:50:31 UTC
I'm going to bet that this is a bug in mcs.

It all starts in ProjectConfiguration.cs:105 (https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs#L105), which has this code:

pset.SetValue ("IntermediateOutputPath", IntermediateOutputDirectory, defaultImPath);

pset is IPropertySet
IntermediateOutputDirectory and defaultImPath are FilePath.

The IPropertySet interface has several overloads for SetValue, see https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs#L51. What the stack trace shows is that Mono is invoking the SetValue overload that takes Object as parameter, instead of the one that takes FilePath, which is a better match in this case. This is what happens with Mono 4.4.0, so it looks like a bug in Mono 4.5.1.
Comment 2 Marek Safar 2016-05-10 15:43:59 UTC
Fixed in master and Mono 4.5