[MonoDevelop] Generics issue

Rafael Teixeira monoman at gmail.com
Thu Jul 20 09:30:20 EDT 2006


I can't reproduce it here, with a not-up-to-date Mono and MD sources
from SVN. Mono was compiled and installed for both profiles 1_1 and
2_0, so that MD could be compiled and support both profiles also.

I compiled code containing this snippet:

<code source="generics.cs">
using System;

public class MyClass<T>{
	public void DoSomething( T t )
	{
		Console.Write("DoSomething: ");
		Console.WriteLine(t);
 	}
}

class MainClass
{
	public static void Main(string[] args)
	{
		MyClass<int> a = new MyClass<int>();
		a.DoSomething(123);
		MyClass<string> b = new MyClass<string>();
		b.DoSomething("abc");
	}
}
</code>

And it compiled and run:

<md-output>
DoSomething: 123
DoSomething: abc
</md-output>

The only things I can think that may be happening with you:
1) Mono not being properly compiled and installed for 2_0 profile.
2) As you didn't give the whole source file, I can't be sure if line 1
pointed by the error doesn't contain some other error (like some
strange character in the source file...)

Have you tried to compile the source file directly with gmcs (mcs
won't be able)?

<terminal>
$ gmcs generics.cs
$ mono generics.exe
DoSomething: 123
DoSomething: abc
</terminal>


:)



On 7/19/06, Carlos J. Muentes <carlos at rockwithme.org> wrote:
> Does anyone have any idea's on this?  I'm kind of stuck right now, and I
> was planning on a release this weekend.  Thanks!
>
>
>
> > -------- Original Message --------
> > Subject: [MonoDevelop] Generics issue
> > From: "Carlos J. Muentes" <carlos at rockwithme.org>
> > Date: Mon, July 17, 2006 4:31 pm
> > To: Monodevelop List <monodevelop-list at lists.ximian.com>
> >
> > I've got a generic class:
> >
> > public class MyClass<T>{
> >   public void DoSomething( T t ){
> >   }
> > }
> >
> > When I compile this in MD, I get
> >
> > [Task:File=, Line=0, Column=0, Type=Error, Description=Operation is not
> > supported.(Exception: System.NotSupportedException)
> > [Task:File=, Line=0, Column=0, Type=Error,
> > Description=[Internal(1,1):,Internal(1,1):](being compiled)
> > [Task:File=, Line=0, Column=0, Type=Error, Description=Operation is not
> > supported.(Exception: System.NotSupportedException)
> > [Task:File=, Line=0, Column=0, Type=Error, Description=Operation is not
> > supported.(.NotSupportedException)
> > [Task:File=, Line=0, Column=0, Type=Error,
> > Description=/home/carlos/Documents/Programming/mono/myproj/MyClass.cs(1,15):(that
> > caused the problem begin at)
> >
> > I selected Mono 2.0 as the runtime in the project options.  If I change
> > the type for 't' to object, it compiles fine.  What am I missing?
> >
> > _______________________________________________
> > Monodevelop-list mailing list
> > Monodevelop-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>


-- 
Rafael "Monoman" Teixeira
---------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw


More information about the Monodevelop-list mailing list