I'm having a very weird behaviour from this method:
public T NavigateTo<T>() where T : Page
{
SetPage<T>();
Console.Clear();
CurrentPage.Display();
return CurrentPage as T;
}
From: https://github.com/uta-org/EasyConsole/blob/master/EasyConsole/Program.cs#L106
The problem is that when Console.Clear()
is reached I continue executing (pressing F10) the scope just exits from the method.
As you can see, as soon as I press F10
(step over) console is displayed again (this means that the breakpoint execution ended).
Why is this happening? And what is returning this method? Because I'd expected a NullReferenceException
:
public MainPage(Program program)
: base("Main Page", program,
new Option("Fork Syncing (complete process)", () => program.NavigateTo<ForkSyncing>().DoLinking = null),
new Option("Fork Syncing (only cloning)", () => program.NavigateTo<ForkSyncing>().DoLinking = true),
new Option("Fork Syncing (only linking)", () => program.NavigateTo<ForkSyncing>().DoLinking = false),
new Option("Exit", () => Environment.Exit(0)))
{
}
I do this as author requested on README. And as you can see I'm setting DoLinking property, and this is not Nullable. (The bug I'm having is that DoLinking is unnasigned so my workflow is not executing as I expected).
I'm experiencing this on Debug and Release build. I'm on .NET 4.6.1.
EDIT:
I didn't realize about the Intelisense IOException. But I put toggled this exception on the Exception Settings window:
And the suggested code by @stimms's answer:
But this is more weird even because any exception is thrown.