Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change constructor error message: Instead of writing "… that takes 0 arguments" omit this part if no constructor is available #75968

Open
SetTrend opened this issue Nov 19, 2024 · 0 comments
Labels
Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Milestone

Comments

@SetTrend
Copy link

SetTrend commented Nov 19, 2024

I'm writing a library for WPF.

In the cause of writing I noticed the following:


Current Situation

The following error message imposes that the number of constructor arguments was insufficient, or it wouldn't match:

Image

Furthermore, the parameter tooltip is giving no information about the constructor itself but about the surrounding method:

Image

After doing some investigation in the WPF source I found that the TextPointer class does not provide any public constructor at all but only internal constructors.

So, the current error message and Intellisense tooltip both seem quite misleading and confusing.


Desired Situation

I suggest to …

  1. alter the error message to not put focus on the number of arguments but instead to read "{ClassName} does not provide any constructor that's available for this protection level",
  2. don't have Intellisense suggest/provide the corresponding class name after new if no potential constructor is available.
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Nov 19, 2024
@CyrusNajmabadi CyrusNajmabadi added Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. and removed Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 19, 2024
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Projects
None yet
Development

No branches or pull requests

2 participants