This project is read-only.
1
Vote

CS0163 documentation and error text do not cover all common causes

description

  1. Compile following Code:
using System.Windows.Forms;

namespace ConsoleApplication1
{
class Program
{
    private void ConfigForm_FormClosing(object sender, FormClosingEventArgs e)
    {
        switch (e.CloseReason)
        {
            case CloseReason.UserClosing:
            case CloseReason.TaskManagerClosing:
                e.Cancel = true;
        }
    }
}
}

Actual Results:
error CS0163: Control cannot fall through from one case label ('case 4:') to another
Expected Results:
error CS0163: Control cannot fall out of the final case label ('case 4:') or similar

comments

Giftednewt wrote Apr 28, 2014 at 10:57 PM

I've been looking into this issue and it appears as though the error message being returned is the same as that returned by pre Roslyn compiler. See MSDN for an example of when this compiler error is returned.

So is this seen as an issue considering that the functionality has not changed?

If it is then I would like to take on this issue and discuss as I can think of a couple of ways that it could be implemented

Kevin_H wrote Apr 29, 2014 at 9:49 PM

Hi Giftednewt,

You are correct, the issue here is a matter of changing the existing Diagnostic that is produced. While it has not been a high priority for us to refine the current behavior, we feel it has merit.

If you want to start working on this and have questions, you can contact me, and I can point you in the right direction.

Thanks!