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

ISB001 misfires on proxy fields that *are* disposed #214

Open
AArnott opened this issue May 30, 2024 · 1 comment
Open

ISB001 misfires on proxy fields that *are* disposed #214

AArnott opened this issue May 30, 2024 · 1 comment

Comments

@AArnott
Copy link
Member

AArnott commented May 30, 2024

        private ITerminalService terminalService;

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            foreach (var token in profferTokens)
                token?.Dispose();

            this.serviceBrokerClient?.Dispose();
            (this.terminalService as IDisposable)?.Dispose();
        }

The field is disposed, but the analyzer still emits this:
error ISB001: The proxy stored in "LinuxConnectionManagerPackage.terminalService" must be disposed by an IDisposable.Dispose or Dispose(bool) method on the "LinuxConnectionManagerPackage" type.

@AArnott
Copy link
Member Author

AArnott commented May 30, 2024

Luca also reported:

I hit this as well, had to explicitly suppress this warning in code, e.g.:

    internal class RenameRefactorCommand : IVsPreviewChangesEngine, IDisposable
    {
        line110: private readonly Microsoft.VisualStudio.Threading.AsyncLazy<ServiceBrokerClient> serviceBrokerClientLazy;

        void IDisposable.Dispose()
        {
            this.serviceBrokerClientLazy.DisposeValue();
        }
    }

C:\vs\src\vc\designtime\Managed\Rename.cs(110,90): error ISB001: The proxy stored in "RenameRefactorCommand.serviceBrokerClientLazy" must be disposed by an IDisposable.Dispose or Dispose(bool) method on the "RenameRefactorCommand" type. (https://github.com/microsoft/vs-servicehub/blob/3423437139210283925dbc2462d5637c9abad978/doc/analyzers/ISB001.md) [C:\vs\src\vc\designtime\Managed\dtmanaged_21vxelbh_wpftmp.csproj]

AArnott pushed a commit to AArnott/vs-servicehub that referenced this issue Aug 27, 2024
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.0 to 17.7.1.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.7.0...v17.7.1)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

1 participant