[Mono-bugs] [Bug 75064][Wis] New - gmcs warns about unused generic method when it is used

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 27 05:34:58 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 dsilva at ccs.neu.edu.

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

--- shadow/75064	2005-05-27 05:34:58.000000000 -0400
+++ shadow/75064.tmp.21598	2005-05-27 05:34:58.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 75064
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dsilva at ccs.neu.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs warns about unused generic method when it is used
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+The method `error' is used in this program, but gmcs does not think so.
+
+public class App {
+
+  public static void Main() {
+    error<int>("the number was {0}", 7);
+  }
+
+  static T error<T>(string format, object obj) {
+    System.Console.WriteLine(format, obj);
+    return default(T);
+  }
+}
+
+$ gmcs err.cs
+err.cs(7) warning CS0169: The private method 'App.error( string,  object)'
+is never used
+Compilation succeeded - 1 warning(s)
+$
+
+Running the program is fine though...
+
+$ mono err.exe
+the number was 7
+$
+
+
+In case it helps, here's the monodis output...
+
+
+$ monodis err.exe
+.assembly extern mscorlib
+{
+  .ver 2:0:3600:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'err'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module err.exe // GUID = {5130E758-A0DA-4EAF-AC69-4335785CA682}
+
+
+  .class public auto ansi beforefieldinit App
+        extends [mscorlib]System.Object
+  {
+
+    // method line 1
+    .method public hidebysig  specialname  rtspecialname
+           instance default void .ctor ()  cil managed
+    {
+        // Method begins at RVA 0x20ec
+        // Code size 7 (0x7)
+        .maxstack 8
+        IL_0000:  ldarg.0
+        IL_0001:  call instance void object::.ctor()
+        IL_0006:  ret
+    } // end of method App::instance default void .ctor ()
+
+    // method line 2
+    .method public static  hidebysig
+           default void Main ()  cil managed
+    {
+        // Method begins at RVA 0x20f4
+        .entrypoint
+        // Code size 18 (0x12)
+        .maxstack 8
+        IL_0000:  ldstr "the number was {0}"
+        IL_0005:  ldc.i4.7
+        IL_0006:  box [mscorlib]System.Int32
+
+** ERROR **: file metadata.c: line 1790
+(mono_metadata_parse_generic_param): assertion failed: (generic_context)
+aborting...
+        IL_000b:  call Aborted


More information about the mono-bugs mailing list