Skip to content

DeclaringSyntaxReferences returns empty list on the underlying ILocalSymbol of a catch statement's variable #6209

@ghost

Description

In VB.Net with the following input:

Try
  '...
Catch exc As Exception
  Console.WriteLine(exc.ToString())
End Try

when I query the DeclaringSyntaxReferences of the local symbol of exc, an empty list is returned.

The problem seems to be that VariableLocalSymbol expects to have a ModifiedIdentifierSyntax, but in case of the catch statement it has an IdentifierNameSyntax, so it returns empty list: http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.VisualBasic/Symbols/Source/LocalSymbol.vb,44cfe5cfa177deb7,references

If I do the same in C#, I get the reference without a problem.

Metadata

Metadata

Assignees

Labels

Area-CompilersBugConcept-APIThis issue involves adding, removing, clarification, or modification of an API.help wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions