Bug 6436 - Cannot parameterize a type with type arguments from a different compilation.
Summary: Cannot parameterize a type with type arguments from a different compilation.
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 3.0.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-08-07 06:13 UTC by Marek Safar
Modified: 2012-08-22 03:35 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 Marek Safar 2012-08-07 06:13:54 UTC
System.InvalidOperationException: Cannot parameterize a type with type arguments from a different compilation.
  at ICSharpCode.NRefactory.TypeSystem.ParameterizedType..ctor (ITypeDefinition genericType, IEnumerable`1 typeArguments) [0x000e2] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs:64 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.LookInUsingScopeNamespace (ICSharpCode.NRefactory.CSharp.TypeSystem.ResolvedUsingScope usingScope, INamespace n, System.String identifier, IList`1 typeArguments, Boolean parameterizeResultType) [0x0006a] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs:1538 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.LookInCurrentUsingScope (System.String identifier, IList`1 typeArguments, Boolean isInUsingDeclaration, Boolean parameterizeResultType) [0x0000e] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs:1476 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.LookupSimpleNameOrTypeName (System.String identifier, IList`1 typeArguments, NameLookupMode lookupMode) [0x00348] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs:1413 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.ResolveSimpleName (System.String identifier, IList`1 typeArguments, Boolean isInvocationTarget) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs:1319 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertTypeHelper (ITypeDefinition typeDef, IList`1 typeArguments) [0x0013f] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:198 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertTypeHelper (IType type) [0x000ba] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:145 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertType (IType type) [0x00011] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:121 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertParameter (IParameter parameter) [0x00057] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:397 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertMethod (IMethod method) [0x0009c] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:616 
  at ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder.ConvertEntity (IEntity entity) [0x0008a] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs:425 
  at ICSharpCode.NRefactory.CSharp.CSharpAmbience.ConvertEntity (IEntity entity, IOutputFormatter formatter, ICSharpCode.NRefactory.CSharp.CSharpFormattingOptions formattingPolicy) [0x0003a] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs:55 
  at ICSharpCode.NRefactory.CSharp.CSharpAmbience.ConvertEntity (IEntity entity) [0x00017] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs:41 
  at MonoDevelop.SourceEditor.LanguageItemTooltipProvider.CreateTooltip (ICSharpCode.NRefactory.Semantics.ResolveResult result, Int32 offset, MonoDevelop.Ide.TypeSystem.Ambience ambience) [0x002d7] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs:260 
  at MonoDevelop.SourceEditor.LanguageItemTooltipProvider.CreateTooltipWindow (Mono.TextEditor.TextEditor editor, Int32 offset, ModifierType modifierState, Mono.TextEditor.TooltipItem item) [0x00164] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs:126 
  at Mono.TextEditor.TextEditor.TooltipTimer () [0x00129] in /Users/builder/data/lanes/monodevelop-mac-master/f568391c/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs:2588 
  at GLib.Timeout+TimeoutProxy.Handler () [0x00000] in <filename unknown>:0
Comment 1 Marek Safar 2012-08-07 06:15:20 UTC
Hover over DoFoo at line 13


using System;
using System.ComponentModel;

namespace CompilerBug
{
	public class EventInfo<TSource, TEventHandler>
		where TEventHandler : class
	{
	}

	public static class EventInfoUtility
	{
		public static void DoFoo<TSource, TTarget>(
			this EventInfo<TSource, EventHandler> info,
			TSource source, TTarget target, Action<TTarget, object, EventArgs> action)
				where TTarget : class
		{
		}


		public static void DoFoo<TSource, TTarget, TEventArgs, TEventHandler>(
			this EventInfo<TSource, TEventHandler> info,
			TSource source, TTarget target,
			Action<TTarget, object, TEventArgs> action)
				where TTarget : class
				where TEventHandler : class
				where TEventArgs : EventArgs
		{
		}
	}

	class EventSource
	{
		public static readonly EventInfo<EventSource, CancelEventHandler> TerminatedEvent = new EventInfo<EventSource, CancelEventHandler>();
	}

	class EventTarget
	{
		public EventTarget(EventSource eventSource)
		{
			EventSource.TerminatedEvent.DoFoo(eventSource, this, (EventTarget t, object s, CancelEventArgs e) => {});
		}
	}

	class Program
	{
		static void Main(string[] arguments)
		{
			EventSource source = new EventSource();
			EventTarget target = new EventTarget(source);
		}
	}
}
Comment 2 Mike Krüger 2012-08-22 03:35:44 UTC
Works in ui refresh.