Skip to content

Setting static readonly properties fails #11571

@Fabi

Description

@Fabi

Hey after updating to the latest .net core 3.0 version today I noticed that setting fields like public static LogTypes LogLevel { get; } through the backing field with FieldInfo.SetValue isn't longer working.

It's throwing $exception {System.FieldAccessException: Cannot set initonly static field '<LogLevel>k__BackingField' after type 'Arctium.Manager.Misc.ManagerConfig' is initialized. now.

The base class got a static Initialize method that is setting all values of the config class at runtime.

The class I'm walking about can be found here: https://github.com/Arctium/WildStar-Server/blob/master/src/Arctium.Manager/src/Misc/ManagerConfig.cs

I saw that this was updated here: dotnet/coreclr@c2abe89#diff-a07ab78d2f4a1c72865756edae89399c

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions