You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Been working on a project using CommunityToolKit.MVVM and observed something off about the intellisense when using the C# version
<LangVersion>Preview</LangVersion>
If declaring an [ObservableProperty] through a field:
/// <summary>
/// My Super Field
/// </summary>
[ObservableProperty] private int myField;
The generated code is:
/// <inheritdoc cref="myField"/>
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.4.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public int MyField
Which means my intellisense will be describing the Property properly based on the private field's summary.
But when using the partial property now available in the preview language:
/// <summary>
/// My Super Property
/// </summary>
[ObservableProperty] public partial int MyProperty { get; private set; }
I get the following generated script:
/// <inheritdoc/>
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.4.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public partial int MyProperty
Meaning that my intellisense now does not provide a proper description of the property.
I need some observable properties to be private set only, which is why I am not using the private field option.
My work around for now has been to declare both field and property manually with the SetProperty function call but I feel like doing so beats the purpose of using MVVM.
Did anyone find a better way or is there a fix incoming which would add the /// to the generated partial property or is that technically not achievable considering the duplication of names?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
Been working on a project using CommunityToolKit.MVVM and observed something off about the intellisense when using the C# version
If declaring an [ObservableProperty] through a field:
The generated code is:
Which means my intellisense will be describing the Property properly based on the private field's summary.
But when using the partial property now available in the preview language:
I get the following generated script:
Meaning that my intellisense now does not provide a proper description of the property.
I need some observable properties to be private set only, which is why I am not using the private field option.
My work around for now has been to declare both field and property manually with the SetProperty function call but I feel like doing so beats the purpose of using MVVM.
Did anyone find a better way or is there a fix incoming which would add the /// to the generated partial property or is that technically not achievable considering the duplication of names?
Thanks for your time and your help.
Beta Was this translation helpful? Give feedback.
All reactions