[Mono-bugs] [Bug 76441][Wis] New - gmcs confused by new() constraint

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Oct 14 13:58:08 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by awaddell at fnfr.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76441

--- shadow/76441	2005-10-14 13:58:08.000000000 -0400
+++ shadow/76441.tmp.23033	2005-10-14 13:58:08.000000000 -0400
@@ -0,0 +1,79 @@
+Bug#: 76441
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: awaddell at fnfr.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs confused by new() constraint
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+
+I keep getting errors like this:
+
+Description of Problem:
+ error CS0310: The type
+Fanfare.SVT.Documents.DeviceDefinition.ResponseMaps.ResponseMap' must have
+a public parameterless constructor in order to use it as parameter `T' in
+the generic type or method
+`Fanfare.Foundation.Collections.SerializableKeyedList`1<T>'
+DeviceDefinition\DeviceDefinition.cs(20,17): error CS0310: The type
+`Fanfare.SVT.Documents.DeviceDefinition.PromptDefinition' must have a
+public parameterless constructor in order to use it as parameter `T' in the
+generic type or method
+`Fanfare.Foundation.Collections.SerializableKeyedList`1<T>'
+
+even though the class in question clearly has a "public parameterless
+constructor".  
+
+Compiles cleanly with MS csc.exe.
+
+Unfortuanately, I haven't been able to reproduce this in a smaller test
+case, but I thought it was worth filing anyway.
+
+Steps to reproduce the problem:
+1. 
+2. 
+3. 
+
+Actual Results:
+
+
+Expected Results:
+clean compile
+
+How often does this happen? 
+always
+
+Additional Information:
+The class in question (SerializableKeyedList) is declared:
+    public class SerializableKeyedList<T> : KeyedList<T>,
+ISerializableElement, ICloneableFrom<SerializableKeyedList<T>> where T :
+IKeyedItem, ISerializableElement, ICloneableFrom<T>, IContainerElement<T>,
+new()
+
+and KeyedList<T> is :
+
+    public class KeyedList<TItem> : IKeyedList, IList<TItem>, IBindingList,
+IStateChangeNotifier, IParent where TItem : IKeyedItem,
+IContainerElement<TItem>, new()
+
+I've worked around this in the Mono case by removing the new() constraint
+from SerializableKeyedList, but it really should be there. MS compiler
+complains when I do this, so I had to do it conditionally.  
+
+The classes using SerializableKeyedList are often in a different assembly
+nad the class they use as TItem may often be in yet another assembly.
+
+Sorry for the lack of a way to reproduce it, but if requested, I may be
+able to get permission to ship out more of our code as a test case.


More information about the mono-bugs mailing list