RF0103: Exported value is read-only
A readonly field or a property without a suitable setter cannot be restored during loading.
For a C# project using Reckfell.NET.Sdk 1.0.0. Fix the first build error first: later messages may be a consequence.
Cause
A readonly field or a property without a suitable setter cannot be restored during loading.
Fix
Make the exported value writable. Keep computed read-only properties unexported. An init-only setter does not replace ordinary loading-time assignment.
Failing example
Save the file in a test C# project and run dotnet build. This version intentionally fails to build.
Example.cs
using Reckfell;
namespace DiagnosticExamples.RF0103;
public partial class Example : Entity { [Export] public readonly int Value = 7; }Expected messages: RF0103.
Working version
Replace the failing version with these files; do not keep both declarations in the project.
Example.cs
using Reckfell;
namespace DiagnosticExamples.RF0103;
public partial class Example : Entity { [Export] public int Value { get; set; } = 7; }Result
After Set("Value", 9), the Value property equals 9.
Related material
Reckfell Engine documentationBack to top ↑