Bug 13148 - Annoying "An error has occurred" message when editing .cshtml files
Summary: Annoying "An error has occurred" message when editing .cshtml files
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2013-07-10 12:12 UTC by Eddy Zavaleta
Modified: 2014-03-28 09:37 UTC (History)
4 users (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 Eddy Zavaleta 2013-07-10 12:12:13 UTC

I am getting an very annoying bug when I am editing .cshtml files containing a 'div' inside a 'li' element. First it highlights the 'li' element with "Parser Warning: Tag 'li' implicity closed by tag 'div'." which it is valid for HTML4, XHTML and HTML5. Second, when I move the caret after the 'li' closing tag an "An error has occurred" message pops up. 

To reproduce the bug just create a new .cshtml file and put the following code:


Then, move the caret after the first 'li'

System.Exception: [Parser Location=168 CurrentStateLength=1
    [MonoDevelop.Xml.StateEngine.XClosingTag Location='[DomRegion FileName=, Begin=(12, 1), End=(0, 0)]']
    [MonoDevelop.Xml.StateEngine.XDocument Location='[DomRegion FileName=, Begin=(1, 1), End=(0, 0)]']
 ---> System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.AspNet.StateEngine.HtmlClosingTagState.PushChar (Char c, IParseContext context, System.String& rollback) [0x0005a] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlClosingTagState.cs:64 
  at MonoDevelop.Xml.StateEngine.Parser.Push (Char c) [0x0006e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs:138 
  --- End of inner exception stack trace ---
  at MonoDevelop.Xml.StateEngine.Parser.Push (Char c) [0x0019c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs:171 
  at MonoDevelop.Ide.Gui.Content.DocumentStateTracker`1[MonoDevelop.Xml.StateEngine.Parser].UpdateEngine (Int32 position) [0x00169] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs:130 
  at MonoDevelop.Ide.Gui.Content.DocumentStateTracker`1[MonoDevelop.Xml.StateEngine.Parser].UpdateEngine () [0x0000d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs:88 
  at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.GetCurrentPath () [0x0000d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs:711 
  at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.UpdatePath () [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs:729 
  at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.<CursorPositionChanged>m__D () [0x00007] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.1.5-branch/c83a26fb/source/monodevelop/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs:551 
  at GLib.Timeout+TimeoutProxy.Handler () [0x00000] in <filename unknown>:0
Comment 1 Mike Krüger 2013-07-23 06:32:32 UTC
Comment 2 Chris F Carroll 2013-09-13 10:22:48 UTC
How do I get the fix? I've updated / deleted - reinstalled Xamarin Studio and I get v4.0.12. 
Which still errors repeatedly when editing html.
Comment 3 Mike Krüger 2013-09-13 10:39:38 UTC
Try the alpha release.
Comment 4 Prashant manu 2014-03-28 09:37:13 UTC
Now no error appears when move the caret after the first 'li' in below code for .cshtml file.
Screencast : http://screencast.com/t/KrQRsosXP

Environment Info:
Xamarin Studio
Version 4.2.4 (build 266) 
Build Information
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba
Mono 3.2.6
Hash: 16bef0b
Xamarin.Android 4.13.0-144 (MAC)