I tried your example code above as is (with Console.WriteLine in each method) and called it from a Button Click handler:
private void button1_Click(object sender, EventArgs e)
{
MyMethod();
}
enum MyEnum
{
firstEnumEntry,
secondEnumEntry
}
MyEnum _enumVariable = MyEnum.firstEnumEntry;
private void MyMethod()
{
switch (_enumVariable)
{
case MyEnum.firstEnumEntry:
_enumVariable = MyEnum.secondEnumEntry;
MyMethod();
break;
case MyEnum.secondEnumEntry:
DoSomeOtherThing();
break;
default:
DoSomeDefaultThing();
break;
}
}
void DoSomething()
{
Console.WriteLine("void DoSomething()");
}
void DoSomeOtherThing()
{
Console.WriteLine("void DoSomeOtherThing()");
}
void DoSomeDefaultThing()
{
Console.WriteLine("void DoSomeDefaultThing()");
}
void DoCoolStuff()
{
Console.WriteLine("void DoCoolStuff()");
}
Ran without breakpoints: printed
void DoSomeOtherThing()
Ran again, with a breakpoint on the switch, and "step into" on each line:
Broke ok
Stepped into "firstEnumEntry"
Stepped into "MyMethod"
Stepped into "secondEnumEntry"
Stepped into "DoSomeOtherThing"
Printed "void DoSomeOtherThing()"
Stepped out of "MyMethod", back to "firstEnumEntry"
break
statement.
Stepped out of "MyMethod"
Which is what I would expect.
Basically, I didn't get any odd effects at all: what are you doing that is different from me? Could it be the contents of your "DoThis" methods?