Skip to content

Add setting to enable asserts. #876

Closed

Description

@safield

Currently when I run the debugger, my asserts are not being triggered.

It would be nice if there was a way I could turn on asserts, potentially in an extension setting or something.

Activity

  1. testforstephen commented on Sep 3, 2020

    @testforstephen
    Contributor

    What's asserts? Please explain your user scenario with more details.

  2. safield commented on Sep 3, 2020

    @safield
    Author

    assert is a keyword in Java, and it behaves like assert does in c++.

    https://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html

    They can be enabled normally by adding a flag to java at runtime. They are not enabled by default when debugging using the vscode extension.

  3. testforstephen commented on Sep 4, 2020

    @testforstephen
    Contributor

    Thanks for the details. Currently you can add vmArgs to "-ea" in the launch.json to enable assert. In future, we're planning to expose a global vmArgs in the user settings, where you can add "-ea" as the default value.

  4. safield commented on Sep 4, 2020

    @safield
    Author

    I currently don't have a launch.json. Should I be expecting one to be present?

  5. testforstephen commented on Sep 4, 2020

    @testforstephen
    Contributor

    By default, the debugger just generates the config in memory. But you could go the debug view to create a launch.json.

    image

  6. testforstephen commented on Oct 19, 2020

    @testforstephen
    Contributor

    With the latest debugger, you could achieve this by adding user setting "java.debug.settings.vmArgs": "-ea".

  7. mediad02 commented on Nov 8, 2021

    @mediad02

    With the latest debugger, you could achieve this by adding user setting "java.debug.settings.vmArgs": "-ea".

    um is there a way to enable asserts for C#?

  8. testforstephen commented on Nov 9, 2021

    @testforstephen
    Contributor

    um is there a way to enable asserts for C#?

    sorry, this extension for Java only. You have to go to C# extension for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions