chaowlert/PrimaryConstructor

Property or indexer cannot be assigned to - it is read only

Closed this issue · 2 comments

vladk commented

I'm getting compile error "Property or indexer 'MyDependency.name' cannot be assigned to -- it is read only" when there is read-only property with expression body.

Code to reproduce the bug:

    [PrimaryConstructor]
    public partial class MyDependency
    {
        public string GetName()
        {
            return "Hello";
        }
        private string name => GetName();
    }

Sorry, I just add readonly property support, but missed the method body case. Just release 1.3.1, pls test.

vladk commented

thanks, issue is resolved in latest version