dotnet / dotnet/fsharp

Non-public properties in generated assembly break code completion

Open
#1,111 0 comments 0 reactions 0 assignees View on GitHub
Area-LangService-AutoComplete Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

I have type provider (generated types) which produces C# assembly. Generated assembly contains class `IsikuStaatus` with property `BaseValue` that has public getter and private setter. When accessing that class via Intellisense I get `` property with error message containing "Property 'BaseValue' on provided type 'IsikuStaatus' has CanWrite=true but there was no value from GetSetMethod()"

According to MSDN it seems that [CanWrite](https://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.canwrite%28v=vs.110%29.aspx) returns false only when setter is not defined, while [GetSetMethod()](https://msdn.microsoft.com/en-us/library/2ef4d5h3%28v=vs.100%29.aspx) returns only public setter method.
#### Repro steps
1. Use type provider which generates properties with non-public setters.
2. Use Intellisense to navigate to some value of type containing that property.
#### Expected behavior

Should display read-only property in completion list.
#### Actual behavior

Displays `` property in completion list with message "Property '%s' on provided type '%s' has CanWrite=true but there was no value from GetSetMethod()"
#### Known workarounds

Ignore `` property message and use expected property as normal (won't display any error in editor or throw exception at runtime).
#### Related information
- Windows 8.1 Enterprise
- FSharp.Core v4.0_4.4.0.0
- .NET Runtime 4.6.1
- Visual Studio 2015, Tsunami

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.