Skip to content

Fix S1144: Nested type constructor accessibility is wrong in the rule message #7774

@neman

Description

@neman

Description

The message I got in VS IDE is:
image

This is not private ctor, but public.
And also this private class is used.

Repro steps

This is the code example

public class TagDto
{
    public int Id { get; set; }
    public string? Name { get; set; }
    public bool System { get; set; }
    public bool Active { get; set; }
    public DateTime? SynchronizedOn { get; set; }

    private class Mapping : Profile
    {
        public Mapping()
        {
            CreateMap<Tag, TagDto>();
        }
    }
}

And this is used as

.ProjectTo<TagDto>(_mapper.ConfigurationProvider),

Related information

  • C#/VB.NET Plugins version: SonarAnalyzer.CSharp Version 9.7.0.75501
  • Visual Studio version: Version 17.7.0 Preview 5.0
  • MSBuild / dotnet version: .NET 8 Preview 5
  • Operating System: Windows

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions