[Mono-bugs] [Bug 79810][Nor] New - [PATCH] CS1058 only applies to 2.0 profile
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Nov 2 14:24:46 EST 2006
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 gert.driesen at pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=79810
--- shadow/79810 2006-11-02 14:24:46.000000000 -0500
+++ shadow/79810.tmp.16576 2006-11-02 14:24:46.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 79810
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: gert.driesen at pandora.be
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [PATCH] CS1058 only applies to 2.0 profile
+
+Currently, mcs reports CS1058 for the following code fragment:
+
+using System:
+
+public class Test
+{
+ static void Main ()
+ {
+ try {
+ } catch (Exception) {
+ } catch {
+ }
+ }
+}
+
+CS1058 should be reported when:
+* a catch (Exception) block is followed by a catch {} block
+AND
+* a RuntimeCompatibilityAttribute with WrapNonExceptionThrows set to true
+is applied to the assembly containing this code
+
+However, in the 1.0 profile a RuntimeCompatibilityAttribute can never
+have been applied to an assembly, as this attribute is not part of the
+1.0 (.NET 1.1) API.
+
+Also, currently we consider WrapNonExceptionThrows to be true by default,
+but this is not correct.
+
+gmcs by default should and does add a RuntimeCompatibilityAttribute with
+WrapNonExceptionThrows set to true, but for assemblies built using 1.0
+profile (mcs), the RuntimeCompatibilityAttribute is not set by default
+and as such CS1058 should be reported.
+
+The attached patch corrects this issue and adds tests for it.
+
+One problem though: I added a test to verify that mcs no longer reports
+CS1058 for the code listed above, but all tests in mcs/tests are compiled
+using both mcs and gmcs, and since gmcs by default adds a
+RuntimeCompatibilityAttribute with WrapNonExceptionThrows set to true,
+that test fails on the 2.0 profile (gmcs reports CS1058, as it should). I
+hoped I could use #if NET_2_0 to add 2.0 specific code that would allow
+me to set WrapNonExceptionThrows to false, but apparently the NET_2_0
+symbol is not passes when compiling the tests using gmcs.
+
+As a workaround, I added that test as a known issue to known_issues_gmcs
+and added a separate test for gmcs.
More information about the mono-bugs
mailing list