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

IDISP007 issue only on build #500

Open
ryanbuening opened this issue Jun 19, 2023 · 0 comments
Open

IDISP007 issue only on build #500

ryanbuening opened this issue Jun 19, 2023 · 0 comments

Comments

@ryanbuening
Copy link

Thanks for this great tool! I have a Blazor application (using .NET 7.0.304) with a code-behind C# file that implements IDisposable

public partial class UnassignedClaims : IDisposable
{ 
	private GoogleMap _map = new();
  ...
	public void Dispose()
	{
		_map.Dispose();
	}
}

GoogleMap looks like the following

namespace GoogleMapsComponents
{
	public class GoogleMap : MapComponent, IDisposable
	{
		void IDisposable.Dispose()
		{
		}
	}
}

I have <TreatWarningsAsErrors>true</TreatWarningsAsErrors> set. There are not any warnings/errors shown in the error list in VS. However, when I go to build, I receive a failed build with:

error IDISP007: Don't dispose injected on _map.Dispose();

  1. Why shouldn't I dispose here?
  2. Why doesn't VS report an issue? I only see this issue after building.
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