dotnet/roslyn

Improve ERR_InaccessibleSymbol2 VB diagnostic

Open

#62.790 aberto em 20 de jul. de 2022

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)C# (4.257 forks)batch import
Area-CompilersConcept-Diagnostic ClarityLanguage-VBhelp wanted

Métricas do repositório

Stars
 (20.414 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

https://github.com/dotnet/roslyn/blob/d72634113d9d36c539732aaf3a188faac26dd7d7/src/Compilers/VisualBasic/Portable/VBResources.resx#L970-L972

The diagnostic can produce the following:

Error BC30389 '{0}' is not accessible in this context because it is 'Public'.

The message can be somewhat confusing, see https://github.com/dotnet/docs/issues/30235 for details.

I suggest using the effective accessibility in place of {1}, and reword it as:

Error BC30389 '{0}' is not accessible in this context because it (or one of the containing symbols) is 'Public'.

Or any other form that's less confusing.

Stackoverflow questions that see this being confused:

https://stackoverflow.com/questions/36713099/why-is-this-public-function-in-a-module-not-accessible https://stackoverflow.com/questions/35346261/new-to-nunit-getting-error-is-not-accessible-in-this-context-because-it-is

Guia do colaborador