Bug 6790 - Layout editor locks edited file
Summary: Layout editor locks edited file
Status: VERIFIED DUPLICATE of bug 9132
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Designer ()
Version: unspecified
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Lluis Sanchez
Depends on:
Reported: 2012-08-31 08:01 UTC by Michael Fink
Modified: 2013-03-20 07:15 UTC (History)
1 user (show)

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:

Description Michael Fink 2012-08-31 08:01:58 UTC
Description of Problem:
When using the Layout editor to edit Android layout xml files, it seems that the layout editor locks the file. When closing the layout editor, the file isn't unlocked. When opening the file with the Code editor and trying to save results in an error message. Exception stack trace below.

Steps to reproduce the problem:
1. Open xml file in Layout editor
2. Close the layout editor again
3. Open xml file in Code editor (using "Open with" context menu item)
4. Edit the file
5. Try to save the file.
6. Error message box appears

Actual Results:
The file isn't saved, and the file can only be closed without saving the file. In the folder, a file named ".#MyLayout.xml" can be found besides the original "MyLayout.xml" file.

Expected Results:
The file can be saved without a message.

How often does this happen? 

Additional Information:

System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.IO.IOException: Der Prozess kann nicht auf die Datei zugreifen, da sie bereits von einem anderen Prozess verwendet wird.
   bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   bei System.IO.__Error.WinIOError()
   bei System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
   bei Mono.TextEditor.Utils.TextFileUtility.SystemRename(String sourceFile, String destFile)
   bei Mono.TextEditor.Utils.TextFileUtility.WriteText(String fileName, String text, Encoding encoding, Boolean hadBom)
   bei MonoDevelop.SourceEditor.SourceEditorView.Save(String fileName, Encoding encoding)
   bei MonoDevelop.SourceEditor.SourceEditorView.Save(String fileName)
   bei MonoDevelop.Ide.Gui.Document.Save()
   bei MonoDevelop.Ide.Gui.ViewCommandHandlers.OnSaveFile()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   bei MonoDevelop.Components.Commands.CommandHandlerInfo.Run(Object cmdTarget, Command cmd)
   bei MonoDevelop.Components.Commands.CommandManager.<>c__DisplayClassb.<DispatchCommand>b__2()
   bei MonoDevelop.Components.Commands.CommandManager.DispatchCommand(Object commandId, Object dataItem, Object initialTarget, CommandSource source)
Comment 1 Lluis Sanchez 2013-03-13 07:57:44 UTC

*** This bug has been marked as a duplicate of bug 9132 ***
Comment 2 Jatin 2013-03-20 07:15:34 UTC
Today with the latest builds:

VS 2012/2010
MFA 4.6.01073
Mono 2.10.12

This issue does not exist, as now the exception does not appear when edit the layout axml file after opening it in the code editor.

Hence, closing this issue.