[Mono-bugs] [Bug 82215][Nor] New - is-operator bug related to generics
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Jul 29 13:55:21 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 flipper98 at gmx.net.
http://bugzilla.ximian.com/show_bug.cgi?id=82215
--- shadow/82215 2007-07-29 13:55:21.000000000 -0400
+++ shadow/82215.tmp.4316 2007-07-29 13:55:21.000000000 -0400
@@ -0,0 +1,84 @@
+Bug#: 82215
+Product: Mono: Compilers
+Version: 1.2
+OS:
+OS Details: Ubuntu feisty
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: flipper98 at gmx.net
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: is-operator bug related to generics
+
+Description of Problem:
+
+The following test case shows a situation where the is-operator fails.
+
+Steps to reproduce the problem:
+See test case.
+
+Actual Results:
+is-operator type comparison (ex is NestedException) returns false, although
+the compared instance is of the compared type.
+
+Note: it works as expected if you remove the generic brackets (<T1, T2>,
+<int, int>) from the class definitions, so i guess the problem is related
+to generics.
+
+Expected Results:
+is-operator type comparison should return true.
+
+How often does this happen?
+always.
+
+Additional Information:
+The problem occurs on both, mono 1.2.3.1 and mono 1.2.4.
+Test case:
+
+using System;
+
+namespace AnyTest
+{
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ B b = new B();
+ b.M();
+ }
+ }
+
+ abstract class A<T1, T2>
+ {
+ public void M() {
+ try {
+ M2();
+ } catch(Exception ex) {
+ if (ex is NestedException)
+ Console.WriteLine("NestedException caught: " + ex.GetType());
+ else
+ Console.WriteLine("Other Exception caught: " + ex.GetType());
+ }
+ }
+
+ protected abstract void M2();
+
+ protected class NestedException : Exception
+ {
+ public NestedException() : base() {}
+ }
+ }
+
+ class B : A<int, int>
+ {
+ protected override void M2() {
+ throw new NestedException();
+ }
+ }
+}
More information about the mono-bugs
mailing list