@@ -204,8 +204,12 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
204
204
match targetSymbolUse.Symbol with
205
205
| :? FSharpEntity as symbol -> symbol.TryGetMetadataText() |> Option.map ( fun text -> text, symbol.DisplayName)
206
206
| :? FSharpMemberOrFunctionOrValue as symbol ->
207
- symbol.ApparentEnclosingEntity.TryGetMetadataText()
208
- |> Option.map ( fun text -> text, symbol.ApparentEnclosingEntity.DisplayName)
207
+ symbol.ApparentEnclosingEntity
208
+ |> Option.bind ( fun entity ->
209
+ entity.TryGetMetadataText()
210
+ |> Option.map ( fun text -> text, entity.DisplayName)
211
+ )
212
+
209
213
| :? FSharpField as symbol ->
210
214
match symbol.DeclaringEntity with
211
215
| Some entity ->
@@ -652,8 +656,11 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) =
652
656
match targetSymbolUse.Symbol with
653
657
| :? FSharpEntity as symbol -> symbol.TryGetMetadataText() |> Option.map ( fun text -> text, symbol.DisplayName)
654
658
| :? FSharpMemberOrFunctionOrValue as symbol ->
655
- symbol.ApparentEnclosingEntity.TryGetMetadataText()
656
- |> Option.map ( fun text -> text, symbol.ApparentEnclosingEntity.DisplayName)
659
+ symbol.ApparentEnclosingEntity
660
+ |> Option.bind ( fun entity ->
661
+ entity.TryGetMetadataText()
662
+ |> Option.map ( fun text -> text, entity.DisplayName)
663
+ )
657
664
| :? FSharpField as symbol ->
658
665
match symbol.DeclaringEntity with
659
666
| Some entity ->
0 commit comments