Skip to content

Suggested change would break code #57472

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression] [worked-in:16.3.1]
A suggested code change recommended comparing two string values using IsNot. This would break the code, because what is required by the existing code is a value comparison, which is nearly always the case when comparing strings.

  1. Dim name As String = "goober"
  2. Dim hasName As Boolean = If(name = "", False, True)

The recommended code change was:

  1. Dim hasName As Boolean = name IsNot ""

Which is plain wrong and breaks the code. However it would compile, so for a novice programmer it appears to work, but the code would fail at runtime. Very Dangerous!!!

Clearly, the recommendation should have been:

  1. Dim hasName As Boolean = name <> ""

Which correctly uses a value comparison.


Original Comments

Feedback Bot on 10/29/2021, 00:20 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEuntriagedIssues and PRs which have not yet been triaged by a lead

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions