Question

We have been using Unity 2.0 for a while now and we have code like this that uses Unity in its most simple case. It compiles and runs fine.

var container = new UnityContainer();            
container.RegisterType<IMyInterface, MyImplementation>();
var myImp = container.Resolve<IMyInterface>();
myImp.DoStuff();

Lately as developers pull Unity down from Nuget they are getting 3.0 instead. The same code compiles and runs. It doesn't show anything in the VS2012 Error List, but the code highlighters are marking it up with the error "Method 'X' does not have type parameters."

I reverted back to a Unity 2.0 reference and it went away. Then I switched back to 3.0 and it stayed away until I closed and re-opened the solution. Now it's back again.

Intellisense won't pull any of the MyImplementation methods with this error in the way.

Was it helpful?

Solution

Props to @JonSkeet in the comments above. The problem was with Resharper and clearing the cache solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top