Skip to content

Compile generated UnsafeAccessors classes don't match underlying class accessibility level #35013

Open
@NicholasMoss

Description

@NicholasMoss

When using EFOptimizeContext for build-time optimisation and your have an Entity which is less accessible than public the generated UnsafeAccessors class will raise inconsistent accessibility errors.

For example even if the source class is internal the generated UnsafeAccessors class will look something like this:

namespace Financials.Data.Read.Common
{
    public static class TestEntityUnsafeAccessors
    {
        [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "<TestProperty>k__BackingField")]
        public static extern ref string TestProperty(TestEntity @this);
    }
}

Where instead the accessibility of TestEntityUnsafeAccessors should be internal to match the source.

Package: Microsoft.EntityFrameworkCore.Tasks 9.0.0-rc.2.24474.1

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions