fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[System.Diagnostics.DebuggerHidden()]; unreachable? 29 May 2018 23:33 #4827

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • In Vulcan adding this statement at the end of a method or function prevents the debugger to step through the lines ofthat code:

    [System.Diagnostics.DebuggerHidden()];

    (It is one of the items on my list of drawbacks VS versus VO where you can just set an attribute to a method for that which is a lot clearer)

    However in X# it gives the error XS0162 Unreachable code detected

    What should I do differently?

    I tried it without () ( as in C#) and without ; (which gives a parser error) so I am not sure how it was changed in X#?

    Dick

    Please Log in or Create an account to join the conversation.

    [System.Diagnostics.DebuggerHidden()]; unreachable? 29 May 2018 23:38 #4828

  • FFF's Avatar

  • FFF


  • Posts: 995
  • Wouldn't that has to be placed in front of the method?

    Karl
    Regards
    Karl (X# 2.5b; Xide 1.25; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    [System.Diagnostics.DebuggerHidden()]; unreachable? 29 May 2018 23:41 #4829

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • Hello Karl,

    Yes you are right, I mixed 2 methods up. But the question remains unchanged...

    Dick

    Please Log in or Create an account to join the conversation.

    [System.Diagnostics.DebuggerHidden()]; unreachable? 30 May 2018 00:06 #4830

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Dick,

    That warning most probably refers to other part of the code, for example something like
    Function Something(l AS LOGIC) AS INT
    IF l
      RETURN 1
    ELSE
      RETURN 2
    ENDIF
    RETURN 0

    so in this case the compiler realizes that the last RETURN statement will never execute. I suspect it will be something similar, but if it is not clear, can you please show us the code?

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Last edit: by Chris.

    [System.Diagnostics.DebuggerHidden()]; unreachable? 30 May 2018 08:27 #4833

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • Hello Chris,

    That warning most probably refers to other part of the code


    Smart and your are absolutely right. I should have seen that the error pointed to the line above it - hence my mix up with "start" and "end" of the method.

    It looks like it works with and without parenthesizes, correct?

    [System.Diagnostics.DebuggerHidden()];
    and
    [System.Diagnostics.DebuggerHidden];

    Dick

    Please Log in or Create an account to join the conversation.

    [System.Diagnostics.DebuggerHidden()]; unreachable? 30 May 2018 10:07 #4838

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Dick,

    Yeah, you can use either versions. In some attributes you can use parameters and in this case you'd need the syntax with the parentheses, for example:

    [DebuggerBrowsable(DebuggerBrowsableState.Never)]

    But for the parameterless attributes, also the "cleaner" syntax without parens is provided as well.

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1