Bugzilla – Bug 324885
[GMCS] is-operator bug related to generics
Last modified: 2008-09-22 18:02:26 UTC
---- Reported by flipper98@gmx.net 2007-07-29 13:55:21 MST ---- 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(); } } } Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>Ubuntu feisty</cf_op_sys_details> Unknown bug field "cf_version_details" encountered while moving bug <cf_version_details>mono 1.2.3.1 and mono 1.2.4</cf_version_details>
I can no longer reproduce this issue with SVN HEAD.