Bug 1717 - Unable to save empty .cs file
Summary: Unable to save empty .cs file
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2011-10-27 06:28 UTC by Nikita Tsukanov
Modified: 2011-10-27 06:47 UTC (History)
1 user (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 Nikita Tsukanov 2011-10-27 06:28:51 UTC
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The source sequence is empty
  at System.Linq.Enumerable.First[Statement] (IEnumerable`1 source) [0x0005b] in /build/buildd/mono-2.10.5/mcs/class/System.Core/System.Linq/Enumerable.cs:834 
  at MonoDevelop.CSharp.HelperMethods.ParseSnippet (ICSharpCode.NRefactory.CSharp.CSharpParser parser, Mono.TextEditor.TextEditorData data) [0x00064] in /build/buildd/monodevelop-latest-1319440647/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/HelperMethods.cs:87 
  at MonoDevelop.CSharp.Formatting.CSharpFormatter.OnTheFlyFormat (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, Mono.TextEditor.TextEditorData data, Int32 startOffset, Int32 endOffset) [0x0001c] in /build/buildd/monodevelop-latest-1319440647/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs:132 
  at MonoDevelop.Ide.CodeFormatting.CodeFormatter.OnTheFlyFormat (MonoDevelop.Projects.Policies.PolicyContainer policyParent, Mono.TextEditor.TextEditorData data, Int32 startOffset, Int32 endOffset) [0x00028] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs:113 
  at MonoDevelop.SourceEditor.SourceEditorView.Save (System.String fileName, System.String encoding) [0x00123] in /build/buildd/monodevelop-latest-1319440647/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:391 
  at MonoDevelop.SourceEditor.SourceEditorView.Save (System.String fileName) [0x00000] in /build/buildd/monodevelop-latest-1319440647/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:359 
  at MonoDevelop.Ide.Gui.Document.Save () [0x00128] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:275 
  at MonoDevelop.Ide.Gui.ViewCommandHandlers.OnSaveFile () [0x00000] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs:71 
  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) [0x000d5] in /build/buildd/mono-2.10.5/mcs/class/corlib/System.Reflection/MonoMethod.cs:226 
  --- 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) [0x000eb] in /build/buildd/mono-2.10.5/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /build/buildd/mono-2.10.5/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00029] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1386 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey42.<>m__56 () [0x0003d] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:597 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in /build/buildd/monodevelop-latest-1319440647/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:614 





How to reproduce:

1) Enable format on save feature
2) Create a .cs file
3) Remove all contents
4) Try to save

If you add some commented text it still will show the same error message.
Comment 1 Mike Krüger 2011-10-27 06:47:12 UTC
fixed.