Bug 2398 - I'm trying to add ctor parameter. Getting the following exception when I start typing with each char.
Summary: I'm trying to add ctor parameter. Getting the following exception when I star...
Status: CLOSED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.9.x
Hardware: Macintosh Mac OS
: High major
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2011-12-07 15:00 UTC by James Clancey
Modified: 2015-08-20 03:24 UTC (History)
3 users (show)

Tags: resolver
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:
CLOSED FIXED

Description James Clancey 2011-12-07 15:00:48 UTC
Hi guys,another code completion problem. I'm trying to add ctor parameter. Getting the following exception when I start typeing with each char.

-----------------System.InvalidCastException: Cannot cast from source type to destination type.  at MonoDevelop.CSharp.CSharpAmbience.GetTypeReferenceString (IType reference, MonoDevelop.TypeSystem.OutputSettings settings) [0x0001a] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:352   at MonoDevelop.CSharp.CSharpAmbience.GetParameterString (IParameterizedMember member, IParameter parameter, MonoDevelop.TypeSystem.OutputSettings settings) [0x000f6] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:702   at MonoDevelop.CSharp.CSharpAmbience.AppendParameter (MonoDevelop.TypeSystem.OutputSettings settings, System.Text.StringBuilder result, IParameter parameter) [0x0009e] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:745   at MonoDevelop.CSharp.CSharpAmbience.AppendParameterList (System.Text.StringBuilder result, MonoDevelop.TypeSystem.OutputSettings settings, IEnumerable`1 parameterList) [0x00034] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:726   at MonoDevelop.CSharp.CSharpAmbience.InternalGetMethodString (IMethod method, MonoDevelop.TypeSystem.OutputSettings settings, System.String methodName, Boolean getReturnType) [0x0017f] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:530   at MonoDevelop.CSharp.CSharpAmbience.GetConstructorString (IMethod method, MonoDevelop.TypeSystem.OutputSettings settings) [0x00000] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpAmbience.cs:551   at MonoDevelop.TypeSystem.Ambience.GetString (IEntity entity, MonoDevelop.TypeSystem.OutputSettings settings) [0x00081] in /private/tmp/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.TypeSystem/Ambience.cs:111   at MonoDevelop.TypeSystem.Ambience.GetString (IEntity entity, OutputFlags flags) [0x00000] in /private/tmp/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.TypeSystem/Ambience.cs:158   at MonoDevelop.CSharp.PathedDocumentTextEditorExtension.UpdatePath (System.Object sender, Mono.TextEditor.DocumentLocationEventArgs e) [0x00160] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs:270   at MonoDevelop.CSharp.PathedDocumentTextEditorExtension.<Initialize>m__72 (System.Object sender, System.EventArgs e) [0x00000] in /private/tmp/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs:47   at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)  at MonoDevelop.Ide.Gui.Document.OnDocumentParsed (System.EventArgs e) [0x0000d] in /private/tmp/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:684   at MonoDevelop.Ide.Gui.Document <StartReparseThread>c__AnonStorey9A <StartReparseThread>c__AnonStorey9B <StartReparseThread>c__AnonStorey9C.<>m__126 (System.Object , System.EventArgs ) [0x0002c] in /private/tmp/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:657   at Gtk.Application InvokeCB.Invoke () [0x00000] in <filename unknown>:0   at GLib.Timeout TimeoutProxy.Handler () [0x00000] in <filename unknown>:0 MonoDevelop: 2.9.1Runtime: Mono 2.10.7 (tarball Mon Dec  5 20:41:19 EST 2011)Operating System: Mac OSX (Unix 11.2.0.0)Distributor: Xamarin
Comment 1 Mike Krüger 2012-01-04 02:49:15 UTC
Fixed in newresolver branch.
Comment 2 PJ 2012-01-05 15:04:19 UTC
Made new class. Added constructor with a string parameter. No crash on autocomplete.

Verified on
MonoDevelop 2.8.5.1
MonoTouch 5.0.4
Mono 2.10.8
Comment 3 Alan McGovern 2012-01-05 15:10:26 UTC
I think the bug was:
1) Create a class
2) Create a constructor with zero (or more?) parameters
3) Add an additional parameter (of type string) to that constructor

Is this what you tested?
Comment 4 PJ 2012-01-05 15:31:00 UTC
Yes indeed! I've linked the test case I created. I expanded the steps I did so it's clear now. Thanks!