Skip to content

[OpenAPI] error CS0122: 'Type' is inaccessible due to its protection level #61037

Closed
@martincostello

Description

@martincostello

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Relates to #60977 (comment).

Using the latest nightly build for .NET 10 preview 3, I get the following error trying to compile a test project that generates XML documentation where the tests depend on an library which references Microsoft.AspNetCore.OpenApi:

C:\Coding\martincostello\openapi-extensions\artifacts\obj\MartinCostello.OpenApi.Extensions.Tests\release_net10.0\Microsoft.AspNetCore.OpenApi.SourceGenerators\Microsoft.AspNetCore.OpenApi.SourceGenerators.XmlCommentGenerator\OpenApiXmlCommentSupport.generated.cs(188,99): error CS0122: 'XmlCommentsHelperTests.SomeClass' is inaccessible due to its protection level

The types causing the error are private nested types of a public test class.

To get that far I also had to add <InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>.

The raises a few questions:

  1. Isn't the need to add InterceptorsNamespaces redundant these days?
  2. Should the source generator be flowing transitively?
  3. Should the source generator ignore projects where IsTestProject=true?

Expected Behavior

The project compiles.

Steps To Reproduce

  1. Clone martincostello/openapi-extensions@6b686d9
  2. Build the solution

Exceptions (if any)

No response

.NET Version

10.0.100-preview.3.25169.19

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions