Bug 5516 - ArgumentNullException when typing '<' inside of asp:Content
Summary: ArgumentNullException when typing '<' inside of asp:Content
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: ASP.Net ()
Version: 3.0.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
: 10998 11720 ()
Depends on:
Blocks:
 
Reported: 2012-06-05 02:11 UTC by Ilya
Modified: 2013-04-10 21:54 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Hack/Fix to get code completion in asp:Content tags working (35.03 KB, text/x-csharp)
2013-01-21 01:53 UTC, David
Details


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 Ilya 2012-06-05 02:11:45 UTC
When i open my .aspx file and type '<' anywhere inside of <asp:Content> the following exception is thrown:

System.ArgumentNullException: Value cannot be null.
Parameter name: project
   at MonoDevelop.Ide.TypeSystem.TypeSystemService.GetProjectContext(Project project)
   at MonoDevelop.Ide.TypeSystem.TypeSystemServiceExt.GetProjectContent(IType type)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.<GetAttributes>d__25.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.AreChildrenAsProperties(IType type, String& defaultProperty)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.GetElementCompletions(CompletionDataList list)
   at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.HandleCodeCompletion(CodeCompletionContext completionContext, Boolean forced, Int32& triggerWordLength)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.HandleCodeCompletion(CodeCompletionContext completionContext, Boolean forced, Int32& triggerWordLength)
   at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.HandleCodeCompletion(CodeCompletionContext completionContext, Char completionChar, Int32& triggerWordLength)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.HandleCodeCompletion(CodeCompletionContext completionContext, Char completionChar, Int32& triggerWordLength)
   at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.XmlEditor.Gui.BaseXmlEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.AspNet.Gui.AspNetEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier)
   at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress(Key key, UInt32 ch, ModifierType state)

Subsequent editing of file doesn't cause an exception to throw, but after closing and reopening file the situation repeats.

Steps to reproduce:

1) Create new ASP.NET MVC Project
2) Open Index.aspx
3) Declare <asp:Content ContentPlaceHolderID="MainContent" runat="server"> </asp:Content>
4) Type '<' without quotations inside of asp:Content tag.

My platform is Win7 64-bit, Mono-2.10.8, MonoDevelop 3.0.2
Comment 1 David 2013-01-17 00:18:27 UTC
Just wanted to add that I am seeing the same issue.

MonoDevelop versions 3.0.5, 3.0.6, and 3.1.1
Ubuntu 12.10 64-bit
Mono 2.10.8.1
Comment 2 David 2013-01-21 01:53:30 UTC
Created attachment 3249 [details]
Hack/Fix to get code completion in asp:Content tags working

Here are my comments as placed in the source code:

//  HACK: This is a proposed break-fix to get code completion 
//  working within asp:Content tags. My initial approach was to set 
//  defaultProp to null and childrenAsProperties to false. Since 
//  that appeared to work without side effects, I copied the few 
//  lines of code that would still be executed below, and commented
//  out everything else, including the AreChildrenAsProperties
//  method, which would now never be called.
//
//  I'll leave it to the developers more familiar with this code 
//  to provide a better long term solution. But for now, this at
//  least gives me, and hopefully other ASP.NET developers, use
//  of code completion within asp:Content tags again.

To use when building MonoDevelop from source: 

- Navigate to monodevelop-3.X.X > src > addins > AspNet > MonoDevelop.AspNet > MonoDevelop.AspNet.Gui

- Rename AspNetEditorExtension.cs to something like AspNetEditorExtension.old

- Copy the attachement AspNetEditorExtension.cs into the folder

- Build and run MonoDevelop as you normally would

To anyone who uses/tests this, I make no guarantees of any particular results or lack of unintended consequences. Use at your own risk. With that having been said, feedback is appreciated.
Comment 3 Mikayla Hutchinson [MSFT] 2013-03-12 18:58:28 UTC
*** Bug 10998 has been marked as a duplicate of this bug. ***
Comment 4 Mikayla Hutchinson [MSFT] 2013-03-12 21:32:07 UTC
Fixed.
Comment 5 Mikayla Hutchinson [MSFT] 2013-04-10 21:54:48 UTC
*** Bug 11720 has been marked as a duplicate of this bug. ***