Skip to content

Incorrect remove-cast suggestion #253

@srivatsn

Description

@srivatsn

Ported from TFS WorkItem: 1113223


Repro Steps:

Add the following code to the end of the declaration of CompilationContext (i.e. inside the class) in Closed\ExpressionEvaluator\VisualBasic\Source\ExpressionCompiler\CompilationContext.vb

 

Friend Shared Sub Test(arg As Object)

Dim identity = If(TryCast(arg, B)?.A, TryCast(arg, A))

End Sub

Class A

End Class

Class B

Public ReadOnly Property A As A

End Class

 

Expected: No offer to remove cast

Actual: Offers to remove this cast.


Revisions:

  1. Created By Andrew Casey (ROSLYN) (1/22/2015 6:18:10 PM)

For some reason, I have been able to repro this in a standalone project, but none of the types are roslyn types.

 

I'm guessing it's related to the conditional access operator.


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions