Visual Studio version: Visual Studio 2019 Enterprise, v16.9.2
Windows version: Windows 10 Professional 64-bit Version 1909 (OS Build: 18363.1198)
I have no control over the Windows Updates as this code is on a VM.
Hi all,
I just recently posted this on the Visual Studio Feedback forums. I am getting weird behavior from the C#
return
keyword. My language version is C# 7.3, with .NET Framework 4.8.
As a programmer with deep experience in C-style languages, my understanding is that the
return
keyword should immediately stop executing the currently-running method: no passing GO, no collecting $200.
However, in my debugging session (and running executable), the following is occurring:
C# return keyword does not work - animation on Imgur[
^]
What is going on is, the debugger correctly activates a call to the
return
keyword and then jumps, not to the close curly brace of the containing method, but rather to the method's final statement. I am encountering this behavior in other places of my code as well.
Is there something not configured correctly, or am I simply stroking out? :-D
Thank you in advance for any suggestions and/or advice.
Sincerely Yours,
Brian Hart
What I have tried:
Looking at Project Properties, searching Google.