genasm generic type constraint violation

?

--

I'm getting a weird error. I've got a class:
public class Editor<C,V> : UserControl where C :
System.Windows.Forms.Control

that's kind of a wrapper around the control C, where C will be of type
TextBox, ComboBox, etc. and V is the type of the thing being edited.

When I try to inherit from it:
public class TextBoxEditor : Editor<System.Windows.Forms.TextBox,
String>

genasm.exe is telling me:
genasm.exe(1) : error There was an error initializing
xxx.TextBoxEditor. GenericArguments[0],
'System.Windows.Forms.TextBox', on xxx.Editor`2[C,V]' violates the
constraint of type 'C'.

Now, I'm pretty certain TextBox is a decedent of Control.
I've looked around and haven't seem this problem before. Any one have
any ideas what's going on?
 
P

Peter Duniho

-- said:
I'm getting a weird error. I've got a class:
public class Editor<C,V> : UserControl where C :
System.Windows.Forms.Control

that's kind of a wrapper around the control C, where C will be of type
TextBox, ComboBox, etc. and V is the type of the thing being edited.

When I try to inherit from it:
public class TextBoxEditor : Editor<System.Windows.Forms.TextBox,
String>

genasm.exe is telling me:
genasm.exe(1) : error There was an error initializing
xxx.TextBoxEditor. GenericArguments[0],
'System.Windows.Forms.TextBox', on xxx.Editor`2[C,V]' violates the
constraint of type 'C'.

Now, I'm pretty certain TextBox is a decedent of Control.
I've looked around and haven't seem this problem before. Any one have
any ideas what's going on?

Are you sure you're in the right newsgroup? I don't think I've even
heard of genasm.exe before your post, and various web and MSDN searches
don't seem to turn up much information at all. What little information
I do see appears to be focused mainly on the Compact Framework. There
is in fact a CF-specific newsgroup, and you may find people more
familiar with this specific issue there.

Note that a number of the search hits I found involved strange errors
using genasm.exe, including problems with it dealing with generic types.
Even if you find people who know something about this, it may turn out
that you're simply seeing a bug or limitation in the tool.

If you are still hoping to receive useful information from this
newsgroup, I'll suggest that you provide a more specific question,
including a concise-but-complete code example that reliably demonstrates
the problem, as well as some background on the genasm.exe tool you're
using, what it does, how it's supposed to be used, etc.

Pete
 
?

--

-- said:
I'm getting a weird error.  I've got a class:
public class Editor<C,V> : UserControl where C :
System.Windows.Forms.Control
that's kind of a wrapper around the control C, where C will be of type
TextBox, ComboBox, etc. and V is the type of the thing being edited.
When I try to inherit from it:
public class TextBoxEditor : Editor<System.Windows.Forms.TextBox,
String>
genasm.exe is telling me:
genasm.exe(1) : error There was an error initializing
xxx.TextBoxEditor.  GenericArguments[0],
'System.Windows.Forms.TextBox', on xxx.Editor`2[C,V]' violates the
constraint of type 'C'.
Now, I'm pretty certain TextBox is a decedent of Control.
I've looked around and haven't seem this problem before.  Any one have
any ideas what's going on?

Are you sure you're in the right newsgroup?  I don't think I've even
heard of genasm.exe before your post, and various web and MSDN searches
don't seem to turn up much information at all.  What little information
I do see appears to be focused mainly on the Compact Framework.  There
is in fact a CF-specific newsgroup, and you may find people more
familiar with this specific issue there.

Note that a number of the search hits I found involved strange errors
using genasm.exe, including problems with it dealing with generic types.
  Even if you find people who know something about this, it may turn out
that you're simply seeing a bug or limitation in the tool.

If you are still hoping to receive useful information from this
newsgroup, I'll suggest that you provide a more specific question,
including a concise-but-complete code example that reliably demonstrates
the problem, as well as some background on the genasm.exe tool you're
using, what it does, how it's supposed to be used, etc.

Pete

genasm.exe is part of the .NET framework [well, it's part of Visual
Studio anyways]. It's not specific to the compact framework. It's
used to generate the design-time versions of libraries and executables
used by Visual Studio.
Here's a full code example of the problem:
namespace xxx
{
public class Editor<C,V> : UserControl
where C : System.Windows.Forms.Control
{
public Editor()
{

}
}

public class TextboxEditor : Editor<System.Windows.Forms.TextBox,
String>
{
public TextboxEditor()
{

}
}
}

Trying to compile this code leads to the error:
genasm.exe(1) : error There was an error initializing
xxx.TextBoxEditor. GenericArguments[0],
'System.Windows.Forms.TextBox', on xxx.Editor`2[C,V]' violates the
constraint of type 'C'.
 
P

Peter Duniho

-- said:
[...]
Trying to compile this code leads to the error:
genasm.exe(1) : error There was an error initializing
xxx.TextBoxEditor. GenericArguments[0],
'System.Windows.Forms.TextBox', on xxx.Editor`2[C,V]' violates the
constraint of type 'C'.

Works fine here, VS2008 and VS2010.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top