[Mono-bugs] [Bug 82443][Nor] New - ConditionalAttribute has no effect on template methods

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 14 20:04:00 EDT 2007


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 jesjones at mindspring.com.

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

--- shadow/82443	2007-08-14 20:04:00.000000000 -0400
+++ shadow/82443.tmp.25281	2007-08-14 20:04:00.000000000 -0400
@@ -0,0 +1,65 @@
+Bug#: 82443
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: jesjones at mindspring.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ConditionalAttribute has no effect on template methods
+
+Description of Problem:
+ConditionalAttribute has no effect on template methods
+
+Steps to reproduce the problem:
+Run the code below.
+
+Actual Results:
+Program prints:
+or this
+but should see this
+
+Expected Results:
+Should not print the "or this" line.
+
+How often does this happen? 
+Always
+
+Additional Information:
+Note that for the DEBUG define at least, you can often work around the
+problem by defining non-template methods if !DEBUG.
+
+-- snip ----------------
+using System;
+using System.Diagnostics;
+
+public class Program
+{
+    [Conditional("DEBUG")]
+    public static void NonTemplate(string line)
+    {
+        Console.WriteLine("{0}", line);
+    }
+
+    [Conditional("DEBUG")]
+    public static void Template<T>(T instance, string line)
+    {
+        Console.WriteLine("{0}", line);
+    }
+
+    public static void Main(string[] args)
+    { 
+        NonTemplate("shouldn't see this");
+        Template(true, "or this");    // this line appears in the output
+        
+        Console.WriteLine("but should see this");
+    }
+}


More information about the mono-bugs mailing list