Skip to content

Open incorrectly considered unused #7111

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

Closed
TysonMN opened this issue Jul 3, 2019 · 4 comments
Closed

Open incorrectly considered unused #7111

TysonMN opened this issue Jul 3, 2019 · 4 comments

Comments

@TysonMN
Copy link

TysonMN commented Jul 3, 2019

I have an open statement that Visual Studio says is unused, but if I remove it, then the code doesn't compile.

Repro steps

When using the open statement:

Open declaration can be removed.

Screenshot 2019-07-03 08 19 00

With the open statement removed:

Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.

Screenshot 2019-07-03 08 20 09

Expected behavior

I think this open statement is being used, so my expectation is that Visual Studio would not suggest to remove it.

Actual behavior

Visual Studio suggests to remove an open statement that seems to be in use.

Known workarounds

Ignore the suggestion from Visual Studio to remove the open statement.

Related information

  • Operating system: Windows 10
  • .NET Runtime kind: .NET Core 3.0 Preview 6
  • Editing Tools: Visual Studio Enterprise 2019 version 16.1.4
@cartermp
Copy link
Contributor

cartermp commented Aug 6, 2020

Closing as duplicate of #3347

Unfortunately there is definitely a bug in the open declarations analyzer. Subtle, but this will happen from time to time.

Would definitely welcome a PR that investigated this - the feature is fairly testable.

@TysonMN
Copy link
Author

TysonMN commented Aug 11, 2020

Better than being a duplicate...I think this bug was fixed. I can't reproduce it any more with this environment.

Operating system: Windows 10
.NET Runtime kind: .NET Core 3.1
Editing Tools: Visual Studio Enterprise 2019 version 16.6.5

Not sure how to obtain that environment again to reproduce the bug either.

@cartermp
Copy link
Contributor

There's definitely been a lot of bug fixes and general improvements since the VS 16.1 release. Glad it doesn't reproduce!

@auduchinok
Copy link
Member

auduchinok commented Sep 2, 2020

This particular case was fixed in #6846.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants