The compiler automatically generates an IsReadOnlyAttribute
on downlevel frameworks even if we have already defined it.
#15313
Labels
Area-Compiler-CodeGen
IlxGen, ilwrite and things at the backend
Bug
Impact-Low
(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Please provide a succinct description of the issue.
Repro steps
Source:
Project:
Expected behavior
Project compiles successfully on both frameworks.
Actual behavior
Project compiles successfully on .NET 7, fails to compile on .NET Standard 2.0 with:
Known workarounds
Don't bother with
IsReadOnlyAttribute
and let the compiler apply it when it sees fit. I guessed that it would apply it toMyRecord
, but it applies it only onX
's getter. It's the same thing in this case, but I tried defining a method to the record, and was not marked asreadonly
.Related information
Encountered when updating the .NET SDK from 7.0.2xx to 7.0.3xx (teo-tsirpanis/Farkle#104). Likely introduced in #14941.
The text was updated successfully, but these errors were encountered: