Bug 17920 - Compiler does not catch error on invalid switch fall-through
Summary: Compiler does not catch error on invalid switch fall-through
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2014-02-21 02:24 UTC by Brett Ernst
Modified: 2014-02-21 03:46 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Brett Ernst 2014-02-21 02:24:12 UTC
Description of Problem:

The code below should produce a compiler error, but it doesn't. Note how one switch case falls through to the next.

using System;

namespace tmp {
	public class Foo {
		public Foo (int i) {
			switch (i) {
				case 1:
					i = 3;
					throw new NotSupportedException("bar");

	class MainClass {
		public static void Main (string[] args) {

Actual Results:
The code compiles.

Expected Results:
It should fail with an error like: Control cannot fall through from one case label ('case 1:') to another
(from VS)

How often does this happen? 
Every time

Additional Information:
Comment 1 Marek Safar 2014-02-21 03:46:08 UTC
Already fixed in mono 3.2.7