Bug 14181 - Copy file and rename throws exception
Summary: Copy file and rename throws exception
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
: 14059 14212 ()
Depends on:
Blocks:
 
Reported: 2013-08-22 06:10 UTC by Federico Di Gregorio
Modified: 2017-02-20 10:46 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 Federico Di Gregorio 2013-08-22 06:10:08 UTC
To reproduce the bug:

1) Copy a file in the solution tab
2) Paste it in the same folder (the file gets the usual "(copy...)" suffix)
3) Rename the file to anything else throws an exception as follows

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An element with the same key already exists in the dictionary.
  at System.Collections.Generic.Dictionary`2[MonoDevelop.Core.FilePath,MonoDevelop.Projects.ProjectFile].Add (FilePath key, MonoDevelop.Projects.ProjectFile value) [0x00163] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:450 
  at MonoDevelop.Projects.ProjectFileCollection.FilePathChanged (System.Object sender, MonoDevelop.Projects.ProjectFilePathChangedEventArgs e) [0x0001b] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFileCollection.cs:147 
  at (wrapper delegate-invoke) System.EventHandler`1<MonoDevelop.Projects.ProjectFilePathChangedEventArgs>:invoke_void__this___object_TEventArgs (object,MonoDevelop.Projects.ProjectFilePathChangedEventArgs)
  at MonoDevelop.Projects.ProjectFile.OnPathChanged (FilePath oldPath, FilePath newPath, FilePath oldVirtualPath, FilePath newVirtualPath) [0x0000e] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs:457 
  at MonoDevelop.Projects.ProjectFile.set_Name (System.String value) [0x000d3] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs:113 
  at MonoDevelop.Projects.SolutionFolder.RenameFileInAllProjects (FilePath oldName, FilePath newName) [0x00075] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:708 
  at MonoDevelop.Projects.SolutionFolder.RenameFileInProjects (FilePath sourceFile, FilePath targetFile) [0x00021] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:697 
  at MonoDevelop.Ide.RootWorkspace.CheckFileRename (System.Object sender, MonoDevelop.Core.FileCopyEventArgs args) [0x00041] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:1302 
  at __EventHandler`1_FileCopyEventArgs_DelegateFactory_2.Dispatch (System.Object ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.GuiSyncContext.AsyncDispatch (MonoDevelop.Ide.StatefulMessageHandler cb, System.Object ob) [0x0000b] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/GuiSyncContext.cs:47 
  at __EventHandler`1_FileCopyEventArgs_DelegateFactory_2.ProxyCall (System.Object , MonoDevelop.Core.FileCopyEventArgs ) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00064] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System.Reflection/MonoMethod.cs:231 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00079] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System.Reflection/MonoMethod.cs:239 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System.Reflection/MethodBase.cs:101 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000d5] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/Delegate.cs:424 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:72 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /tmp/buildd/mono-3.0.6+dfsg2/mcs/class/corlib/System/Delegate.cs:398 
  at MonoDevelop.Core.EventQueue.RaiseEvent (System.Func`1 d, System.Object thisObj, System.EventArgs args) [0x00069] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs:856 
  at MonoDevelop.Core.EventQueue.RaiseEvent (System.Func`1 d, System.EventArgs args) [0x00001] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs:839 
  at MonoDevelop.Core.FileService.OnFileRenamed (MonoDevelop.Core.FileCopyEventArgs args) [0x00062] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs:649 
  at MonoDevelop.Core.FileService.RenameFile (System.String oldName, System.String newName) [0x00057] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs:137 
  at MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectFileNodeCommandHandler.RenameItem (System.String newName) [0x0016c] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs:181 
  at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView.HandleOnEdit (System.Object o, Gtk.EditedArgs e) [0x000b6] in /home/fog/Workspaces/mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs:1288
Comment 1 Jeffrey Stedfast 2013-08-22 19:24:27 UTC
fixed in git master
Comment 2 Jeffrey Stedfast 2013-08-22 19:25:19 UTC
*** Bug 14059 has been marked as a duplicate of this bug. ***
Comment 3 Shruti 2014-03-28 02:05:35 UTC
I have verified this issue with following steps :
1. Create a new project.
2. Copy a .cs File.
3. Paste it in same solution. 
4. Rename the copied file. File name is renamed successfully without any error.

Refer Screencast for the same :
http://screencast.com/t/82ymBzjsa

Environment Info :
=== Xamarin Studio ===

Version 4.2.4 (build 266)
Installation UUID: 400bab6b-f5cd-4e84-a1d1-39f9d6414cb1
Runtime:
	Microsoft .NET 4.0.30319.18449
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.13.0 (Trial Edition)
Android SDK: E:\SDK\AndroidSDK
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		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)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 402040266
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Build date: 2014-03-20 12:27:02-04
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 4 Matt Ward 2017-02-20 10:46:36 UTC
*** Bug 14212 has been marked as a duplicate of this bug. ***