Skip to content

"Class 'Foo' is never instantiated" message not suppressed with Ninject #15

Closed
vigrid opened this Issue Jun 18, 2012 · 3 comments

3 participants

@vigrid
vigrid commented Jun 18, 2012

.NET 4.0, Visual Studio 2010 Ultimate (10.0.40219.1 SP1Rel), ReSharper 6.1.37.86, Ninject 3.0.1.10 via nuget.

I am still getting a warning for the 'Foo' class, with this code:

using System;
using Ninject;
using Ninject.Modules;


namespace MulderNinject
{
    class Program
    {
        static void Main()
        {
            using (IKernel kernel = new StandardKernel(new TestModule()))
            {
                var foo = kernel.Get<IFoo>();
                foo.Bar();
            }
        }
    }

    class TestModule : NinjectModule
    {
        public override void Load()
        {
            Bind<IFoo>().To<Foo>();
        }
    }

    interface IFoo
    {
        void Bar();
    }

    class Foo : IFoo
    {
        public void Bar()
        {
            Console.WriteLine("Bar");
        }
    }
}
@hmemcpy hmemcpy was assigned Jun 19, 2012
@jcomtois

I've always had the same behavior using Agent Mulder and Ninject no matter what. It can identify the registrations and offer you to navigate to them, but it never suppresses ReSharper's warnings, which is what I actually want it to do most of the time.

@hmemcpy
Owner
hmemcpy commented Feb 13, 2014

Yeah, I'm sorry about that :(
I'm afraid I've neglected Mulder recently, I think something changed in ReSharper, and now my 'unused' suppression doesn't really work.
I'll need to fix that!

Anyway, thanks for reporting. I'll try to get on this ASAP.

@jcomtois

Thanks, I hadn't really thought much about it until I watched your ReSharper Webinar today and they were plugging Agent Mulder so I came to check out if I was just doing something wrong or what.

@hmemcpy hmemcpy added a commit that closed this issue Jun 10, 2015
@hmemcpy Removed the old TypeUsageManager and replaced it with a proper IUsage…
…InspectionsSuppressor implementation.

If anything, this should finally fix #15, after 3 years!
ba747dc
@hmemcpy hmemcpy closed this in ba747dc Jun 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.