hmemcpy / AgentMulder

** THIS PLUGIN IS NO LONGER MAINTAINED. PLEASE FOLLOW ERNICOMMUNITY FOR UPDATES **
https://github.com/ERNICommunity/AgentMulder
MIT License
151 stars 33 forks source link

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

Closed vigrid closed 9 years ago

vigrid commented 12 years ago

.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");
        }
    }
}
jcomtois commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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.