Bug 1303 - Exception from recent files when opening file
Summary: Exception from recent files when opening file
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: PC Windows
: Low major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-10-06 09:33 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-03-21 22:08 UTC (History)
3 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 Mikayla Hutchinson [MSFT] 2011-10-06 09:33:42 UTC
When opening a file, MD will sometimes throw an exception because it's unable to write the recent file storage. if the file was already in the recent files list, it gets removed.

This happens on Windows with multiple instances of MD open. However, I imagine it could also happen on other platforms, especially on Linux, where other programs can read/write the file.

We already try to read the file multiple times in case of locks, we should do it when writing too.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: The process cannot access the file 'C:\Users\Michael\AppData\Local\MonoDevelop-2.8\Config\RecentlyUsed.xml' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
   at MonoDevelop.Ide.Desktop.RecentFileStorage.WriteStore(List`1 items) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 257
   at MonoDevelop.Ide.Desktop.RecentFileStorage.FilterOut(Func`2 pred) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 123
   at MonoDevelop.Ide.Desktop.RecentFileStorage.RemoveItem(String uri) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 157
   at MonoDevelop.Ide.Desktop.RecentFileStorage.RemoveItem(RecentItem item) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 162
   at MonoDevelop.Ide.Desktop.RecentFileStorage.CheckLimit(String group, Int32 limit) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 201
   at MonoDevelop.Ide.Desktop.RecentFileStorage.AddWithLimit(RecentItem item, String group, Int32 limit) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentFileStorage.cs:line 212
   at MonoDevelop.Ide.Desktop.FdoRecentFiles.Add(String grp, String fileName, String displayName) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentOpen.cs:line 105
   at MonoDevelop.Ide.Desktop.FdoRecentFiles.AddFile(String fileName, String displayName) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentOpen.cs:line 92
   at MonoDevelop.Ide.Desktop.RecentFiles.AddFile(String fileName, Project project) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Desktop\RecentOpen.cs:line 143
   at MonoDevelop.Ide.Gui.Workbench.RealOpenFile(FileOpenInformation openFileInfo) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui\Workbench.cs:line 762
   at MonoDevelop.Ide.Gui.Workbench.OpenDocument(FilePath fileName, Int32 line, Int32 column, OpenDocumentOptions options, String encoding, IViewDisplayBinding binding) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui\Workbench.cs:line 388
   at MonoDevelop.Ide.Gui.Workbench.OpenDocument(FilePath fileName, OpenDocumentOptions options) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui\Workbench.cs:line 319
   at MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectFileNodeCommandHandler.ActivateItem() in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Pads.ProjectPad\ProjectFileNodeBuilder.cs:line 182
   at MonoDevelop.Ide.Gui.Components.NodeCommandHandler.ActivateMultipleItems() in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Components\NodeCommandHandler.cs:line 100
   at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView.ActivateCurrentItem() in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Components\ExtensibleTreeView.cs:line 834
   at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView.OnNodeActivated(Object sender, RowActivatedArgs args) in c:\Users\Michael\work\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Components\ExtensibleTreeView.cs:line 1935
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at GLib.Signal.ClosureInvokedCB(Object o, ClosureInvokedArgs args)
   at GLib.SignalClosure.Invoke(ClosureInvokedArgs args)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
Comment 1 Mike Krüger 2011-11-15 14:33:27 UTC
It's 75% fixed - exception won't happen, but recent files don't work correctly either ... we shouldn't use the recent files.
Comment 2 Mikayla Hutchinson [MSFT] 2012-03-21 22:08:18 UTC
This has been REALLY annoying on Windows, since it would cause MD to frequently lose files from the recent files list when there were two instances of MD open. Fixed properly.